Commit 1144ab9b authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Daniel Borkmann

tools/resolve_btf_ids: Close ELF file on error

Fix one case where we don't do explicit clean up.

Fixes: fbbb68de ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211124002325.1737739-2-andrii@kernel.org
parent 2fe256a4
...@@ -167,7 +167,7 @@ static struct btf_id *btf_id__find(struct rb_root *root, const char *name) ...@@ -167,7 +167,7 @@ static struct btf_id *btf_id__find(struct rb_root *root, const char *name)
return NULL; return NULL;
} }
static struct btf_id* static struct btf_id *
btf_id__add(struct rb_root *root, char *name, bool unique) btf_id__add(struct rb_root *root, char *name, bool unique)
{ {
struct rb_node **p = &root->rb_node; struct rb_node **p = &root->rb_node;
...@@ -730,7 +730,8 @@ int main(int argc, const char **argv) ...@@ -730,7 +730,8 @@ int main(int argc, const char **argv)
if (obj.efile.idlist_shndx == -1 || if (obj.efile.idlist_shndx == -1 ||
obj.efile.symbols_shndx == -1) { obj.efile.symbols_shndx == -1) {
pr_debug("Cannot find .BTF_ids or symbols sections, nothing to do\n"); pr_debug("Cannot find .BTF_ids or symbols sections, nothing to do\n");
return 0; err = 0;
goto out;
} }
if (symbols_collect(&obj)) if (symbols_collect(&obj))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment