[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220617174414.495392e2@gandalf.local.home>
Date: Fri, 17 Jun 2022 17:44:14 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Wang ShaoBo <bobo.shaobowang@...wei.com>
Cc: <cj.chengjian@...wei.com>, <linux-kernel@...r.kernel.org>,
<liwei391@...wei.com>, <mhiramat@...nel.org>, <acme@...hat.com>,
<yuehaibing@...wei.com>
Subject: Re: [PATCH 2/2] libtraceevent: fix free NULL pointer in
parse_arg_add()
On Fri, 13 May 2022 10:33:08 +0800
Wang ShaoBo <bobo.shaobowang@...wei.com> wrote:
> Should not call free if parg->format is NULL.
>
> Fixes: e7a90882b05b ("tools lib traceevent: Optimize pretty_print() function")
> Signed-off-by: Wang ShaoBo <bobo.shaobowang@...wei.com>
> ---
> tools/lib/traceevent/event-parse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index 69e4d5229362..b1a07db54457 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -5461,9 +5461,11 @@ static int parse_arg_add(struct tep_print_parse **parse, char *format,
> return 0;
> error:
> if (parg) {
> - free(parg->format);
> + if (parg->format)
> + free(parg->format);
It's perfectly fine to call free(NULL).
This is not a bug fix.
-- Steve
> free(parg);
> }
> +
> return -1;
> }
>
Powered by blists - more mailing lists