summaryrefslogtreecommitdiff
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2020-04-29 04:21:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-22 10:31:00 +0300
commit1dbb13ceedac8200ba452cf896c6114ce4b84e08 (patch)
treefe1a52581c2481ab8ba46f4c5356239ac90d6f68 /tools/testing/selftests
parent58ee4d253753bd110911773aee9d088963b649c3 (diff)
downloadlinux-1dbb13ceedac8200ba452cf896c6114ce4b84e08.tar.xz
selftests/bpf: Fix memory leak in extract_build_id()
[ Upstream commit 9f56bb531a809ecaa7f0ddca61d2cf3adc1cb81a ] getline() allocates string, which has to be freed. Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID") Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Cc: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20200429012111.277390-7-andriin@fb.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/bpf/test_progs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 3bf18364c67c..8cb3469dd11f 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -293,6 +293,7 @@ int extract_build_id(char *build_id, size_t size)
len = size;
memcpy(build_id, line, len);
build_id[len] = '\0';
+ free(line);
return 0;
err:
fclose(fp);