aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHewenliang <[email protected]>2019-12-09 01:35:49 -0500
committerArnaldo Carvalho de Melo <[email protected]>2019-12-20 18:47:50 -0300
commitf84ae29a6169318f9c929720c49d96323d2bbab9 (patch)
tree490d543eb2e4ae728867ad37f635b691925813fa
parent9f0bff1180efc9ea988fed3fd93da7647151ac8b (diff)
tools lib traceevent: Fix memory leakage in filter_event
It is necessary to call free_arg(arg) when add_filter_type() returns NULL in filter_event(). Signed-off-by: Hewenliang <[email protected]> Reviewed-by: Steven Rostedt (VMware) <[email protected]> Cc: Feilong Lin <[email protected]> Cc: Tzvetomir Stoyanov <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/lib/traceevent/parse-filter.c4
1 files changed, 3 insertions, 1 deletions
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);