summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRiccardo Mancini <rickyman7@gmail.com>2021-07-15 18:07:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-28 11:13:47 +0200
commit2ce4170c20781187ef2888a4a24b6d0cfa4c4ddf (patch)
tree5b0e03eef8f7a9522db791c9a4d6de743d76562e
parent2c1d156b94636f8b6d00c95e39616efa6a6b894d (diff)
downloadlinux-stable-2ce4170c20781187ef2888a4a24b6d0cfa4c4ddf.tar.gz
linux-stable-2ce4170c20781187ef2888a4a24b6d0cfa4c4ddf.tar.bz2
linux-stable-2ce4170c20781187ef2888a4a24b6d0cfa4c4ddf.zip
perf test bpf: Free obj_buf
[ Upstream commit 937654ce497fb6e977a8c52baee5f7d9616302d9 ] ASan reports some memory leaks when running: # 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 <rickyman7@gmail.com> Fixes: ba1fae431e74bb42 ("perf test: Add 'perf test BPF'") Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lore.kernel.org/lkml/60f3ca935fe6672e7e866276ce6264c9e26e4c87.1626343282.git.rickyman7@gmail.com [ Added missing stdlib.h include ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--tools/perf/tests/bpf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 79b54f8ddebf..df478f67b6b6 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -1,5 +1,6 @@
#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
#include <sys/epoll.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -277,6 +278,7 @@ static int __test__bpf(int idx)
}
out:
+ free(obj_buf);
bpf__clear();
return ret;
}