]>
Commit | Line | Data |
---|---|---|
5ddacef6 SLM |
1 | From c3c3ef0e621a187dd21c49171bb742445d77831d Mon Sep 17 00:00:00 2001 |
2 | From: Changbin Du <changbin.du@gmail.com> | |
3 | Date: Sat, 16 Mar 2019 16:05:56 +0800 | |
4 | Subject: perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test() | |
5 | ||
6 | [ Upstream commit d982b33133284fa7efa0e52ae06b88f9be3ea764 ] | |
7 | ||
8 | ================================================================= | |
9 | ==20875==ERROR: LeakSanitizer: detected memory leaks | |
10 | ||
11 | Direct leak of 1160 byte(s) in 1 object(s) allocated from: | |
12 | #0 0x7f1b6fc84138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138) | |
13 | #1 0x55bd50005599 in zalloc util/util.h:23 | |
14 | #2 0x55bd500068f5 in perf_evsel__newtp_idx util/evsel.c:327 | |
15 | #3 0x55bd4ff810fc in perf_evsel__newtp /home/work/linux/tools/perf/util/evsel.h:216 | |
16 | #4 0x55bd4ff81608 in test__perf_evsel__tp_sched_test tests/evsel-tp-sched.c:69 | |
17 | #5 0x55bd4ff528e6 in run_test tests/builtin-test.c:358 | |
18 | #6 0x55bd4ff52baf in test_and_print tests/builtin-test.c:388 | |
19 | #7 0x55bd4ff543fe in __cmd_test tests/builtin-test.c:583 | |
20 | #8 0x55bd4ff5572f in cmd_test tests/builtin-test.c:722 | |
21 | #9 0x55bd4ffc4087 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302 | |
22 | #10 0x55bd4ffc45c6 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354 | |
23 | #11 0x55bd4ffc49ca in run_argv /home/changbin/work/linux/tools/perf/perf.c:398 | |
24 | #12 0x55bd4ffc5138 in main /home/changbin/work/linux/tools/perf/perf.c:520 | |
25 | #13 0x7f1b6e34809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) | |
26 | ||
27 | Indirect leak of 19 byte(s) in 1 object(s) allocated from: | |
28 | #0 0x7f1b6fc83f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30) | |
29 | #1 0x7f1b6e3ac30f in vasprintf (/lib/x86_64-linux-gnu/libc.so.6+0x8830f) | |
30 | ||
31 | Signed-off-by: Changbin Du <changbin.du@gmail.com> | |
32 | Reviewed-by: Jiri Olsa <jolsa@kernel.org> | |
33 | Cc: Alexei Starovoitov <ast@kernel.org> | |
34 | Cc: Daniel Borkmann <daniel@iogearbox.net> | |
35 | Cc: Namhyung Kim <namhyung@kernel.org> | |
36 | Cc: Peter Zijlstra <peterz@infradead.org> | |
37 | Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> | |
38 | Fixes: 6a6cd11d4e57 ("perf test: Add test for the sched tracepoint format fields") | |
39 | Link: http://lkml.kernel.org/r/20190316080556.3075-17-changbin.du@gmail.com | |
40 | Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> | |
41 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
42 | --- | |
43 | tools/perf/tests/evsel-tp-sched.c | 1 + | |
44 | 1 file changed, 1 insertion(+) | |
45 | ||
46 | diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c | |
47 | index ea772d41e472..b5d0be524655 100644 | |
48 | --- a/tools/perf/tests/evsel-tp-sched.c | |
49 | +++ b/tools/perf/tests/evsel-tp-sched.c | |
50 | @@ -84,5 +84,6 @@ int test__perf_evsel__tp_sched_test(int subtest __maybe_unused) | |
51 | if (perf_evsel__test_field(evsel, "target_cpu", 4, true)) | |
52 | ret = -1; | |
53 | ||
54 | + perf_evsel__delete(evsel); | |
55 | return ret; | |
56 | } | |
57 | -- | |
58 | 2.19.1 | |
59 |