tools lib traceevent: Fix memory leakage in filter_event
PATCH 1/1 tools lib traceevent: Fix memory leakage in filter_event
It is necessary to call free_arg(arg) when add_filter_type returns NULL in the function of filter_event.
--- tools/lib/traceevent/parse-filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/traceevent/parse-filter.c +3 -1
@@ -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);
Signature · 1 line
2.19.1
Quoted 4 lines · On Mon, 9 Dec 2019 01:35:49 -0500 Hewenliang <[email protected]> wrote:
It is necessary to call
free_arg(arg)whenadd_filter_typereturns NULL in the function offilter_event.Signed-off-by Hewenliang <[email protected]>
This looks fine.
Arnaldo, care to take this?
-- Steve
Quoted 20 lines
--- tools/lib/traceevent/parse-filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/lib/traceevent/parse-filter.c +3
-1@@ -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);
Em Thu, Dec 19, 2019 at 08:56:31PM -0500, Steven Rostedt escreveu:
Quoted 6 lines
Quoted 3 lines · On Mon, 9 Dec 2019 01:35:49 -0500 Hewenliang <[email protected]> wrote:
It is necessary to call
free_arg(arg)whenadd_filter_typereturns NULL in the function offilter_event.
Quoted 7 lines
Quoted 1 line
Signed-off-by Hewenliang <[email protected]>This looks fine.
Reviewed-by Steven Rostedt (VMware) <[email protected]>Arnaldo, care to take this?
Sure, just landed in acme/perf/urgent :)
- Arnaldo
Quoted 22 lines
-- Steve
Quoted 20 lines
--- tools/lib/traceevent/parse-filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/lib/traceevent/parse-filter.c +3
-1@@ -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);
The following commit has been merged into the perf/urgent branch of tip:
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: f84ae29a6169318f9c929720c49d96323d2bbab9 Gitweb: https://git.kernel.org/tip/f84ae29a6169318f9c929720c49d96323d2bbab9 Author: Hewenliang <[email protected]> AuthorDate: Mon, 09 Dec 2019 01:35:49 -05:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Fri, 20 Dec 2019 18:47:50 -03:00
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().
--- tools/lib/traceevent/parse-filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/traceevent/parse-filter.c +3 -1
@@ -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);