libbpf: Fix memory leak in btf__dedup()
authorMauricio Vásquez <mauricio@kinvolk.io>
Fri, 22 Oct 2021 20:20:35 +0000 (15:20 -0500)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 22 Oct 2021 23:00:53 +0000 (16:00 -0700)
commit1000298c76830bc291358e98e8fa5baa3baa9b3a
treed4180ef03c40382c4d9880dd1d02b6273f288caf
parent57385ae31ff0ffa6e9c9ae39206740efdc7f5972
libbpf: Fix memory leak in btf__dedup()

Free btf_dedup if btf_ensure_modifiable() returns error.

Fixes: 919d2b1dbb07 ("libbpf: Allow modification of BTF and add btf__add_str API")
Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211022202035.48868-1-mauricio@kinvolk.io
tools/lib/bpf/btf.c