Commit 6cb939e8 authored by Hewenliang's avatar Hewenliang Committed by Greg Kroah-Hartman

tools lib traceevent: Fix memory leakage in filter_event

[ Upstream commit f84ae29a ]

It is necessary to call free_arg(arg) when add_filter_type() returns NULL
in filter_event().
Signed-off-by: default avatarHewenliang <hewenliang4@huawei.com>
Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Feilong Lin <linfeilong@huawei.com>
Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Link: http://lore.kernel.org/lkml/20191209063549.59941-1-hewenliang4@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 17d87b3e
......@@ -1227,8 +1227,10 @@ filter_event(struct event_filter *filter, struct event_format *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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment