[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <157449690001.21853.5746866915759646419.tip-bot2@tip-bot2>
Date: Sat, 23 Nov 2019 08:15:00 -0000
From: "tip-bot2 for Hewenliang" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Hewenliang <hewenliang4@...wei.com>,
"Steven Rostedt (VMware)" <rostedt@...dmis.org>,
Tzvetomir Stoyanov <tstoyanov@...are.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
x86 <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: [tip: perf/core] libtraceevent: Fix memory leakage in copy_filter_type
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 10992af6bf46a2048ad964985a5b77464e5563b1
Gitweb: https://git.kernel.org/tip/10992af6bf46a2048ad964985a5b77464e5563b1
Author: Hewenliang <hewenliang4@...wei.com>
AuthorDate: Mon, 18 Nov 2019 20:44:15 -05:00
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitterDate: Fri, 22 Nov 2019 10:48:14 -03:00
libtraceevent: Fix memory leakage in copy_filter_type
It is necessary to free the memory that we have allocated when error occurs.
Fixes: ef3072cd1d5c ("tools lib traceevent: Get rid of die in add_filter_type()")
Signed-off-by: Hewenliang <hewenliang4@...wei.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
Cc: Tzvetomir Stoyanov <tstoyanov@...are.com>
Link: http://lore.kernel.org/lkml/20191119014415.57210-1-hewenliang4@huawei.com
Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/lib/traceevent/parse-filter.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 552592d..f3cbf86 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -1473,8 +1473,10 @@ static int copy_filter_type(struct tep_event_filter *filter,
if (strcmp(str, "TRUE") == 0 || strcmp(str, "FALSE") == 0) {
/* Add trivial event */
arg = allocate_arg();
- if (arg == NULL)
+ if (arg == NULL) {
+ free(str);
return -1;
+ }
arg->type = TEP_FILTER_ARG_BOOLEAN;
if (strcmp(str, "TRUE") == 0)
@@ -1483,8 +1485,11 @@ static int copy_filter_type(struct tep_event_filter *filter,
arg->boolean.value = 0;
filter_type = add_filter_type(filter, event->id);
- if (filter_type == NULL)
+ if (filter_type == NULL) {
+ free(str);
+ free_arg(arg);
return -1;
+ }
filter_type->filter = arg;
Powered by blists - more mailing lists