]> git.baikalelectronics.ru Git - kernel.git/commit
bpftool: Fix memory leak in prog_dump()
authorQuentin Monnet <quentin@isovalent.com>
Wed, 10 Nov 2021 11:46:27 +0000 (11:46 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 15 Nov 2021 02:34:08 +0000 (18:34 -0800)
commit7b411961da851bdeff2ee929187492c6d7fb719e
tree7fba64ecd8cbaa7e268e53524433373ccd910197
parent6b7351067c106c09a69603c0d156d4451bc3194e
bpftool: Fix memory leak in prog_dump()

Following the extraction of prog_dump() from do_dump(), the struct btf
allocated in prog_dump() is no longer freed on error; the struct
bpf_prog_linfo is not freed at all. Make sure we release them before
exiting the function.

Fixes: aeeada59ce26 ("bpftool: Match several programs with same tag")
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211110114632.24537-2-quentin@isovalent.com
tools/bpf/bpftool/prog.c