From: Steven Rostedt <rostedt@goodmis.org>
To: Hewenliang <hewenliang4@huawei.com>
Cc: <acme@redhat.com>, <tstoyanov@vmware.com>,
<linux-kernel@vger.kernel.org>, <linfeilong@huawei.com>
Subject: Re: [PATCH] tools lib traceevent: Fix memory leakage in filter_event
Date: Thu, 19 Dec 2019 20:56:31 -0500 [thread overview]
Message-ID: <20191219205631.2e12571c@rorschach.local.home> (raw)
In-Reply-To: <20191209063549.59941-1-hewenliang4@huawei.com>
On Mon, 9 Dec 2019 01:35:49 -0500
Hewenliang <hewenliang4@huawei.com> wrote:
> It is necessary to call free_arg(arg) when add_filter_type returns NULL in
> the function of filter_event.
>
> Signed-off-by: Hewenliang <hewenliang4@huawei.com>
This looks fine.
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Arnaldo, care to take this?
-- Steve
> ---
> tools/lib/traceevent/parse-filter.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
> index f3cbf86e51ac..20eed719542e 100644
> --- a/tools/lib/traceevent/parse-filter.c
> +++ b/tools/lib/traceevent/parse-filter.c
> @@ -1228,8 +1228,10 @@ filter_event(struct tep_event_filter *filter, struct tep_event *event,
> }
>
> filter_type = add_filter_type(filter, event->id);
> - if (filter_type == NULL)
> + if (filter_type == NULL) {
> + free_arg(arg);
> return TEP_ERRNO__MEM_ALLOC_FAILED;
> + }
>
> if (filter_type->filter)
> free_arg(filter_type->filter);
next prev parent reply other threads:[~2019-12-20 1:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 6:35 Hewenliang
2019-12-20 1:56 ` Steven Rostedt [this message]
2019-12-20 21:47 ` Arnaldo Carvalho de Melo
2019-12-23 21:35 ` [tip: perf/urgent] " tip-bot2 for Hewenliang
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=20191219205631.2e12571c@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=acme@redhat.com \
--cc=hewenliang4@huawei.com \
--cc=linfeilong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tstoyanov@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
Powered by JetHome