summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2020-01-16 00:00:19 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-01-16 00:23:27 +0100
commitd7de72674af53c3839eff091899f18c221dd30d2 (patch)
tree159843e4663abd55fb9170ea1bd833bf1ba64dcb /usr
parentMerge branch 'bpf-batch-ops' (diff)
downloadlinux-d7de72674af53c3839eff091899f18c221dd30d2.tar.xz
linux-d7de72674af53c3839eff091899f18c221dd30d2.zip
bpftool: Fix a leak of btf object
When testing a map has btf or not, maps_have_btf() tests it by actually getting a btf_fd from sys_bpf(BPF_BTF_GET_FD_BY_ID). However, it forgot to btf__free() it. In maps_have_btf() stage, there is no need to test it by really calling sys_bpf(BPF_BTF_GET_FD_BY_ID). Testing non zero info.btf_id is good enough. Also, the err_close case is unnecessary, and also causes double close() because the calling func do_dump() will close() all fds again. Fixes: 99f9863a0c45 ("bpftool: Match maps by name") Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Cc: Paul Chaignon <paul.chaignon@orange.com> Link: https://lore.kernel.org/bpf/20200115230019.1101352-1-kafai@fb.com
Diffstat (limited to 'usr')
0 files changed, 0 insertions, 0 deletions