Commit 3cea36c9 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Greg Kroah-Hartman

selftests/bpf: Fix memory leak in extract_build_id()

[ Upstream commit 9f56bb53 ]

getline() allocates string, which has to be freed.

Fixes: 81f77fd0 ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20200429012111.277390-7-andriin@fb.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
parent fbcd5803
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment