libbpf: Fix memory leak when emitting final btf_ext
authorAndrii Nakryiko <andrii@kernel.org>
Sat, 27 Mar 2021 04:25:02 +0000 (21:25 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 30 Mar 2021 14:38:36 +0000 (07:38 -0700)
commit05d817031ff9686a8206039b19e37616cf9e1d44
tree427327f17c4ce85fe062d98b9f1f9a7342b4dd6d
parentb83fd195c228bdb7b45f3933919296fa6511fcf5
libbpf: Fix memory leak when emitting final btf_ext

Free temporary allocated memory used to construct finalized .BTF.ext data.
Found by Coverity static analysis on libbpf's Github repo.

Fixes: 8fd27bf69b86 ("libbpf: Add BPF static linker BTF and BTF.ext support")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20210327042502.969745-1-andrii@kernel.org
tools/lib/bpf/linker.c