Skip to content

Commit

Permalink
tools/resolve_btf_ids: close ELF file on error
Browse files Browse the repository at this point in the history
Fix one case where we don't do explicit clean up.

Fixes: fbbb68d ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
  • Loading branch information
anakryiko authored and Nobody committed Nov 25, 2021
1 parent f770c45 commit caf8753
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/bpf/resolve_btfids/main.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit caf8753

Please sign in to comment.