summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2021-11-24 03:23:13 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-03-08 21:12:33 +0300
commit83ef63535a8a620f36fb3ffc19fba421c78ce3e0 (patch)
tree6c524842861f347e1eab67de87f6ddacc49358b8
parent1bd12b7aaee0c1c818101de4a46bb56b8fdc8ccb (diff)
downloadlinux-83ef63535a8a620f36fb3ffc19fba421c78ce3e0.tar.xz
tools/resolve_btf_ids: Close ELF file on error
[ Upstream commit 1144ab9bdf3430e1b5b3f22741e5283841951add ] 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 Signed-off-by: Sasha Levin <sashal@kernel.org>
-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 de6365b53c9c..45e0d640618a 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -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;
@@ -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))