Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Ian Rogers and committed by
Namhyung Kim
7b172b92 874fa827

+6 -2
+6 -2
tools/perf/builtin-trace.c
··· 5339 5339 zfree(&trace->syscalls.table); 5340 5340 } 5341 5341 zfree(&trace->perfconfig_events); 5342 + evlist__delete(trace->evlist); 5343 + trace->evlist = NULL; 5342 5344 #ifdef HAVE_LIBBPF_SUPPORT 5343 5345 btf__free(trace->btf); 5344 5346 trace->btf = NULL; ··· 5721 5719 } 5722 5720 } 5723 5721 5724 - if ((argc >= 1) && (strcmp(argv[0], "record") == 0)) 5725 - return trace__record(&trace, argc-1, &argv[1]); 5722 + if ((argc >= 1) && (strcmp(argv[0], "record") == 0)) { 5723 + err = trace__record(&trace, argc-1, &argv[1]); 5724 + goto out; 5725 + } 5726 5726 5727 5727 /* Using just --errno-summary will trigger --summary */ 5728 5728 if (trace.errno_summary && !trace.summary && !trace.summary_only)