[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220513023308.2400381-3-bobo.shaobowang@huawei.com>
Date: Fri, 13 May 2022 10:33:08 +0800
From: Wang ShaoBo <bobo.shaobowang@...wei.com>
To: unlisted-recipients:; (no To-header on input)
CC: <bobo.shaobowang@...wei.com>, <cj.chengjian@...wei.com>,
<linux-kernel@...r.kernel.org>, <liwei391@...wei.com>,
<mhiramat@...nel.org>, <rostedt@...dmis.org>, <acme@...hat.com>,
<yuehaibing@...wei.com>
Subject: [PATCH 2/2] libtraceevent: fix free NULL pointer in parse_arg_add()
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);
free(parg);
}
+
return -1;
}
--
2.25.1
Powered by blists - more mailing lists