Re: [PATCH 19/20] perf test: bpf: free obj_buf
From: Arnaldo Carvalho de Melo <acme@kernel.org>
Date: 2021-07-16 16:50:18
Also in:
lkml
Em Thu, Jul 15, 2021 at 06:07:24PM +0200, Riccardo Mancini escreveu:
quoted hunk ↗ jump to hunk
ASan reports some memory leaks when running the perf test "42: BPF filter". The first of these leaks is caused by obj_buf never being deallocated in __test__bpf. This patch adds the missing free. Signed-off-by: Riccardo Mancini <redacted> --- tools/perf/tests/bpf.c | 1 + 1 file changed, 1 insertion(+)diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c index 33bda9c265423547..2cda4a6297e07967 100644 --- a/tools/perf/tests/bpf.c +++ b/tools/perf/tests/bpf.c@@ -276,6 +276,7 @@ static int __test__bpf(int idx) } out: + free(obj_buf); bpf__clear(); return ret; }--
I followed the advice and added the stdlib.h include, elsewhere we're
getting included via some other include by luck.
- Arnaldo
66 6.97 ubuntu:18.04-x-m68k : FAIL gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
tests/bpf.c: In function '__test__bpf':
tests/bpf.c:279:2: error: implicit declaration of function 'free' [-Werror=implicit-function-declaration]
free(obj_buf);
^~~~
tests/bpf.c:279:2: error: incompatible implicit declaration of built-in function 'free' [-Werror]
tests/bpf.c:279:2: note: include '<stdlib.h>' or provide a declaration of 'free'
cc1: all warnings being treated as errors
/git/perf-5.14.0-rc1/tools/build/Makefile.build:139: recipe for target 'tests' failed
make[3]: *** [tests] Error 2