perf parse-event: Add init and exit to parse_event_error
parse_events() may succeed but leave string memory allocations reachable in the error. Add an init/exit that must be called to initialize and clean up the error. This fixes a leak in metricgroup parse_ids. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: John Garry <john.garry@huawei.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20211107090002.3784612-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
6c1912898e
commit
07eafd4e05
@@ -115,12 +115,13 @@ int test__backward_ring_buffer(struct test *test __maybe_unused, int subtest __m
|
||||
goto out_delete_evlist;
|
||||
}
|
||||
|
||||
bzero(&parse_error, sizeof(parse_error));
|
||||
parse_events_error__init(&parse_error);
|
||||
/*
|
||||
* Set backward bit, ring buffer should be writing from end. Record
|
||||
* it in aux evlist
|
||||
*/
|
||||
err = parse_events(evlist, "syscalls:sys_enter_prctl/overwrite/", &parse_error);
|
||||
parse_events_error__exit(&parse_error);
|
||||
if (err) {
|
||||
pr_debug("Failed to parse tracepoint event, try use root\n");
|
||||
ret = TEST_SKIP;
|
||||
|
||||
Reference in New Issue
Block a user