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
[ Upstream commit 1144ab9 ]

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>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211124002325.1737739-2-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
anakryiko authored and gregkh committed Mar 8, 2022
1 parent 1bd12b7 commit 83ef635
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/bpf/resolve_btfids/main.c
Expand Up @@ -166,7 +166,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 @@ -720,7 +720,8 @@ int main(int argc, const char **argv)
if (no_fail)
return 0;
pr_err("FAILED to find needed sections\n");
return -1;
err = 0;
goto out;
}

if (symbols_collect(&obj))
Expand Down

0 comments on commit 83ef635

Please sign in to comment.