From: Steven Rostedt <rostedt@goodmis.org>
To: Yordan Karadzhov <ykaradzhov@vmware.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 2/3] kernel-shark: Fix a memory leak in the sched_events plugin
Date: Tue, 5 Mar 2019 12:07:45 -0500 [thread overview]
Message-ID: <20190305120745.3e7a8091@gandalf.local.home> (raw)
In-Reply-To: <20190305143924.11056-3-ykaradzhov@vmware.com>
On Tue, 5 Mar 2019 16:39:23 +0200
Yordan Karadzhov <ykaradzhov@vmware.com> wrote:
> 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 ...")
I took the patch, but don't truncate the fixes line. It's fine to go
over 80 characters:
Fixes: 4f392730e ("kernel-shark-qt: Make Sched event plugin use its own data collections")
-- Steve
> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
> ---
> 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;
>
next prev parent reply other threads:[~2019-03-05 17:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-05 14:39 [PATCH 0/3] Improvements and fixes for sched_switch plugin Yordan Karadzhov
2019-03-05 14:39 ` [PATCH 1/3] kernel-shark: Define free_contex function for the sched_events plugin Yordan Karadzhov
2019-03-05 15:54 ` Slavomir Kaslev
2019-03-05 17:11 ` Steven Rostedt
2019-03-05 14:39 ` [PATCH 2/3] kernel-shark: Fix a memory leak in " Yordan Karadzhov
2019-03-05 15:56 ` Slavomir Kaslev
2019-03-05 17:12 ` Steven Rostedt
2019-03-05 17:07 ` Steven Rostedt [this message]
2019-03-05 14:39 ` [PATCH 3/3] kernel-shark: sched_events plugin init with sched_switch events only Yordan Karadzhov
2019-03-05 15:57 ` Slavomir Kaslev
2019-03-05 17:13 ` Steven Rostedt
2019-03-05 17:09 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190305120745.3e7a8091@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=ykaradzhov@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).