mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
perf trace: Fix evlist memory leak
Leak sanitizer was reporting a memory leak in the "perf record and replay" test. Add evlist__delete to trace__exit, also ensure trace__exit is called after trace__record. Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Arnaldo Carvalho de Melo <acme@kernel.org> Link: https://lore.kernel.org/r/20250319050741.269828-15-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
874fa827df
commit
7b172b92c1
|
|
@ -5339,6 +5339,8 @@ static void trace__exit(struct trace *trace)
|
|||
zfree(&trace->syscalls.table);
|
||||
}
|
||||
zfree(&trace->perfconfig_events);
|
||||
evlist__delete(trace->evlist);
|
||||
trace->evlist = NULL;
|
||||
#ifdef HAVE_LIBBPF_SUPPORT
|
||||
btf__free(trace->btf);
|
||||
trace->btf = NULL;
|
||||
|
|
@ -5719,8 +5721,10 @@ int cmd_trace(int argc, const char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if ((argc >= 1) && (strcmp(argv[0], "record") == 0))
|
||||
return trace__record(&trace, argc-1, &argv[1]);
|
||||
if ((argc >= 1) && (strcmp(argv[0], "record") == 0)) {
|
||||
err = trace__record(&trace, argc-1, &argv[1]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Using just --errno-summary will trigger --summary */
|
||||
if (trace.errno_summary && !trace.summary && !trace.summary_only)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user