Skip to content

Commit 68878a5

Browse files
Zhen Leiborkmann
Zhen Lei
authored andcommitted
bpftool: Fix error return value in build_btf_type_table
An appropriate return value should be set on the failed path. Fixes: 4d374ba ("tools: bpftool: implement "bpftool btf show|list"") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Zhen Lei <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 36ccdf8 commit 68878a5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/bpf/bpftool/btf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ build_btf_type_table(struct btf_attach_table *tab, enum bpf_obj_type type,
693693
obj_node = calloc(1, sizeof(*obj_node));
694694
if (!obj_node) {
695695
p_err("failed to allocate memory: %s", strerror(errno));
696+
err = -ENOMEM;
696697
goto err_free;
697698
}
698699

0 commit comments

Comments
 (0)