When the sched_events plugin fails to initialize not all the memory allocated for the context of the plugin is freed properly. The problem gets fixed by using the free_context helper function defined in the previous patch. Fixes: 4f392730e ("kernel-shark-qt: Make Sched event plugin use ...") Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> --- kernel-shark/src/plugins/sched_events.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel-shark/src/plugins/sched_events.c b/kernel-shark/src/plugins/sched_events.c index 0d6de2d..fe13e6a 100644 --- a/kernel-shark/src/plugins/sched_events.c +++ b/kernel-shark/src/plugins/sched_events.c @@ -74,8 +74,12 @@ static bool plugin_sched_init_context(struct kshark_context *kshark_ctx) event = tep_find_event_by_name(plugin_ctx->pevent, "sched", "sched_switch"); - if (!event) + if (!event) { + plugin_free_context(plugin_ctx); + plugin_sched_context_handler = NULL; + return false; + } plugin_ctx->sched_switch_event = event; plugin_ctx->sched_switch_next_field = @@ -320,11 +324,8 @@ static int plugin_sched_init(struct kshark_context *kshark_ctx) { struct plugin_sched_context *plugin_ctx; - if (!plugin_sched_init_context(kshark_ctx)) { - free(plugin_sched_context_handler); - plugin_sched_context_handler = NULL; + if (!plugin_sched_init_context(kshark_ctx)) return 0; - } plugin_ctx = plugin_sched_context_handler; -- 2.19.1