forked from xen-troops/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit 42dfa45
committed
perf evsel: Free evsel->counts in perf_evsel__exit()
Using gcc's ASan, Changbin reports:
=================================================================
==7494==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 48 byte(s) in 1 object(s) allocated from:
#0 0x7f0333a89138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
#1 0x5625e5330a5e in zalloc util/util.h:23
#2 0x5625e5330a9b in perf_counts__new util/counts.c:10
#3 0x5625e5330ca0 in perf_evsel__alloc_counts util/counts.c:47
xen-troops#4 0x5625e520d8e5 in __perf_evsel__read_on_cpu util/evsel.c:1505
xen-troops#5 0x5625e517a985 in perf_evsel__read_on_cpu /home/work/linux/tools/perf/util/evsel.h:347
xen-troops#6 0x5625e517ad1a in test__openat_syscall_event tests/openat-syscall.c:47
xen-troops#7 0x5625e51528e6 in run_test tests/builtin-test.c:358
xen-troops#8 0x5625e5152baf in test_and_print tests/builtin-test.c:388
xen-troops#9 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
xen-troops#10 0x5625e515572f in cmd_test tests/builtin-test.c:722
xen-troops#11 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
xen-troops#12 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
xen-troops#13 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
xen-troops#14 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
xen-troops#15 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
Indirect leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x7f0333a89138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
#1 0x5625e532560d in zalloc util/util.h:23
#2 0x5625e532566b in xyarray__new util/xyarray.c:10
#3 0x5625e5330aba in perf_counts__new util/counts.c:15
xen-troops#4 0x5625e5330ca0 in perf_evsel__alloc_counts util/counts.c:47
xen-troops#5 0x5625e520d8e5 in __perf_evsel__read_on_cpu util/evsel.c:1505
xen-troops#6 0x5625e517a985 in perf_evsel__read_on_cpu /home/work/linux/tools/perf/util/evsel.h:347
xen-troops#7 0x5625e517ad1a in test__openat_syscall_event tests/openat-syscall.c:47
xen-troops#8 0x5625e51528e6 in run_test tests/builtin-test.c:358
xen-troops#9 0x5625e5152baf in test_and_print tests/builtin-test.c:388
xen-troops#10 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
xen-troops#11 0x5625e515572f in cmd_test tests/builtin-test.c:722
xen-troops#12 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
xen-troops#13 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
xen-troops#14 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
xen-troops#15 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
xen-troops#16 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
His patch took care of evsel->prev_raw_counts, but the above backtraces
are about evsel->counts, so fix that instead.
Reported-by: Changbin Du <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt (VMware) <[email protected]>
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>1 parent 1e5b0cf commit 42dfa45Copy full SHA for 42dfa45
File tree
Expand file treeCollapse file tree
1 file changed
+1
-0
lines changedFilter options
- tools/perf/util
Expand file treeCollapse file tree
1 file changed
+1
-0
lines changed+1Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1292 | 1292 |
| |
1293 | 1293 |
| |
1294 | 1294 |
| |
| 1295 | + | |
1295 | 1296 |
| |
1296 | 1297 |
| |
1297 | 1298 |
| |
|
0 commit comments