Skip to content

Commit 937654c

Browse files
Manciukicacmel
authored andcommitted
perf test bpf: Free obj_buf
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 <[email protected]> Fixes: ba1fae4 ("perf test: Add 'perf test BPF'") Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lore.kernel.org/lkml/60f3ca935fe6672e7e866276ce6264c9e26e4c87.1626343282.git.rickyman7@gmail.com [ Added missing stdlib.h include ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 659ede7 commit 937654c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/perf/tests/bpf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <errno.h>
33
#include <stdio.h>
4+
#include <stdlib.h>
45
#include <sys/epoll.h>
56
#include <sys/types.h>
67
#include <sys/stat.h>
@@ -276,6 +277,7 @@ static int __test__bpf(int idx)
276277
}
277278

278279
out:
280+
free(obj_buf);
279281
bpf__clear();
280282
return ret;
281283
}

0 commit comments

Comments
 (0)