[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191223133241.8578-2-acme@kernel.org>
Date: Mon, 23 Dec 2019 10:32:38 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Clark Williams <williams@...hat.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Hewenliang <hewenliang4@...wei.com>,
Steven Rostedt <rostedt@...dmis.org>,
Feilong Lin <linfeilong@...wei.com>,
Tzvetomir Stoyanov <tstoyanov@...are.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 1/4] tools lib traceevent: Fix memory leakage in filter_event
From: Hewenliang <hewenliang4@...wei.com>
It is necessary to call free_arg(arg) when add_filter_type() returns NULL
in filter_event().
Signed-off-by: Hewenliang <hewenliang4@...wei.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
Cc: Feilong Lin <linfeilong@...wei.com>
Cc: Tzvetomir Stoyanov <tstoyanov@...are.com>
Link: http://lore.kernel.org/lkml/20191209063549.59941-1-hewenliang4@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
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);
--
2.21.1
Powered by blists - more mailing lists