mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
selftests/bpf: Fix memory leak in extract_build_id()
[ Upstream commit9f56bb531a] getline() allocates string, which has to be freed. Fixes:81f77fd0de("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
58ee4d2537
commit
1dbb13ceed
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user