Messages in this thread Patch in this message | | | From | Wang ShaoBo <> | Subject | [PATCH 2/2] libtraceevent: fix free NULL pointer in parse_arg_add() | Date | Fri, 13 May 2022 10:33:08 +0800 |
| |
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@huawei.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
| |