summaryrefslogtreecommitdiff
path: root/tools/bpf/resolve_btfids
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2021-11-23 16:23:13 -0800
committerDaniel Borkmann <daniel@iogearbox.net>2021-11-26 00:14:06 +0100
commit1144ab9bdf3430e1b5b3f22741e5283841951add (patch)
tree89f729ea7950008cf75cb9680143bf5577ec983b /tools/bpf/resolve_btfids
parent2fe256a429cb6c0b0064563af4158470143a363c (diff)
tools/resolve_btf_ids: Close ELF file on error
Fix one case where we don't do explicit clean up. Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20211124002325.1737739-2-andrii@kernel.org
Diffstat (limited to 'tools/bpf/resolve_btfids')
-rw-r--r--tools/bpf/resolve_btfids/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index a59cb0ee609c..e9e6166c3f28 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -167,7 +167,7 @@ static struct btf_id *btf_id__find(struct rb_root *root, const char *name)
return NULL;
}
-static struct btf_id*
+static struct btf_id *
btf_id__add(struct rb_root *root, char *name, bool unique)
{
struct rb_node **p = &root->rb_node;
@@ -730,7 +730,8 @@ int main(int argc, const char **argv)
if (obj.efile.idlist_shndx == -1 ||
obj.efile.symbols_shndx == -1) {
pr_debug("Cannot find .BTF_ids or symbols sections, nothing to do\n");
- return 0;
+ err = 0;
+ goto out;
}
if (symbols_collect(&obj))