]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, libbpf: fixing leak when kernel does not support btf
authorNikita V. Shirokov <tehnerd@tehnerd.com>
Fri, 8 Mar 2019 05:18:14 +0000 (05:18 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 8 Mar 2019 20:16:36 +0000 (21:16 +0100)
commitf8cbabb51630d73ff9d144909d727a8fee88a362
tree0a2e293600e43da600aaaccfbcf9fdea971d5870
parentf6e6fcdc49e1532f4436daed830f4916518c6586
bpf, libbpf: fixing leak when kernel does not support btf

We could end up in situation when we have object file w/ all btf
info, but kernel does not support btf yet. In this situation
currently libbpf just set obj->btf to NULL w/o freeing it first.
This patch is fixing it by making sure to run btf__free first.

Fixes: 1f9d34bba70a ("btf: separate btf creation and loading")
Signed-off-by: Nikita V. Shirokov <tehnerd@tehnerd.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c