@@ -222,12 +222,10 @@ QStringList KsCaptureControl::_getPlugins()
if (!all_tracers)
return pluginList;
- for (int i = 0; all_tracers[i]; ++i) {
+ for (int i = 0; all_tracers[i]; ++i)
pluginList << all_tracers[i];
- free(all_tracers[i]);
- }
- free(all_tracers);
+ kshark_tracecmd_plugin_list_free(all_tracers);
std::sort(pluginList.begin(), pluginList.end());
return pluginList;
@@ -1724,6 +1724,11 @@ char **kshark_tracecmd_local_plugins()
return tracefs_tracers(tracefs_tracing_dir());
}
+void kshark_tracecmd_plugin_list_free(char **list)
+{
+ tracefs_list_free(list);
+}
+
/**
* @brief Free an array, allocated by kshark_tracecmd_get_hostguest_mapping() API
*
@@ -51,6 +51,8 @@ void kshark_tep_filter_reset(struct kshark_data_stream *stream);
char **kshark_tracecmd_local_plugins();
+void kshark_tracecmd_plugin_list_free(char **list);
+
struct tep_handle;
struct tep_handle *kshark_get_tep(struct kshark_data_stream *stream);
The list of local plugins, returned by tracefs_tracers() must be freed using tracefs_list_free(). Reported-by: yinkui.zhang@xedge.ai Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> --- src/KsCaptureDialog.cpp | 6 ++---- src/libkshark-tepdata.c | 5 +++++ src/libkshark-tepdata.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-)