diff options
author | Andrii Nakryiko <andriin@fb.com> | 2020-04-28 18:21:06 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-06-22 09:05:14 +0200 |
commit | 3cea36c903da102cd81307bc2c9a07f212fd6f39 (patch) | |
tree | 294671698a8ae0e7567846defc633a831fa6bc12 /tools | |
parent | fbcd580375fe0740850ef62fb2be250abe8b56de (diff) | |
download | linux-stable-3cea36c903da102cd81307bc2c9a07f212fd6f39.tar.gz linux-stable-3cea36c903da102cd81307bc2c9a07f212fd6f39.tar.bz2 linux-stable-3cea36c903da102cd81307bc2c9a07f212fd6f39.zip |
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')
-rw-r--r-- | tools/testing/selftests/bpf/test_progs.c | 1 |
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 89f8b0dae7ef..bad3505d66e0 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -1118,6 +1118,7 @@ static 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); |