The list of local plugins, returned by tracefs_tracers() must be freed using tracefs_list_free(). Reported-by: yinkui.zhang@xxxxxxxx Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- src/KsCaptureDialog.cpp | 6 ++---- src/libkshark-tepdata.c | 5 +++++ src/libkshark-tepdata.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/KsCaptureDialog.cpp b/src/KsCaptureDialog.cpp index ca4c2bc..651f811 100644 --- a/src/KsCaptureDialog.cpp +++ b/src/KsCaptureDialog.cpp @@ -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; diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c index 08aca09..b435a29 100644 --- a/src/libkshark-tepdata.c +++ b/src/libkshark-tepdata.c @@ -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 * diff --git a/src/libkshark-tepdata.h b/src/libkshark-tepdata.h index 1b955be..c67c06b 100644 --- a/src/libkshark-tepdata.h +++ b/src/libkshark-tepdata.h @@ -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); -- 2.32.0