diff options
author | Martin KaFai Lau <[email protected]> | 2020-01-15 15:00:19 -0800 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2020-01-15 15:23:27 -0800 |
commit | d7de72674af53c3839eff091899f18c221dd30d2 (patch) | |
tree | 159843e4663abd55fb9170ea1bd833bf1ba64dcb /drivers/usb/cdns3/cdns3-debug.h | |
parent | 990bca1fc8ad48f7f8b0786b739a9408017b7a74 (diff) |
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 <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Cc: Paul Chaignon <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'drivers/usb/cdns3/cdns3-debug.h')
0 files changed, 0 insertions, 0 deletions