Skip to content

Commit 4a04cb3

Browse files
Pu Lehuianakryiko
authored andcommitted
selftests/bpf: Fix btf leak on new btf alloc failure in btf_distill test
Fix btf leak on new btf alloc failure in btf_distill test. Fixes: affdeb5 ("selftests/bpf: Extend distilled BTF tests to cover BTF relocation") Signed-off-by: Pu Lehui <pulehui@huawei.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20250115100241.4171581-1-pulehui@huaweicloud.com
1 parent 7c311b7 commit 4a04cb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/bpf/prog_tests/btf_distill.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static void test_distilled_base_missing_err(void)
385385
"[2] INT 'int' size=8 bits_offset=0 nr_bits=64 encoding=SIGNED");
386386
btf5 = btf__new_empty();
387387
if (!ASSERT_OK_PTR(btf5, "empty_reloc_btf"))
388-
return;
388+
goto cleanup;
389389
btf__add_int(btf5, "int", 4, BTF_INT_SIGNED); /* [1] int */
390390
VALIDATE_RAW_BTF(
391391
btf5,
@@ -478,7 +478,7 @@ static void test_distilled_base_multi_err2(void)
478478
"[1] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED");
479479
btf5 = btf__new_empty();
480480
if (!ASSERT_OK_PTR(btf5, "empty_reloc_btf"))
481-
return;
481+
goto cleanup;
482482
btf__add_int(btf5, "int", 4, BTF_INT_SIGNED); /* [1] int */
483483
btf__add_int(btf5, "int", 4, BTF_INT_SIGNED); /* [2] int */
484484
VALIDATE_RAW_BTF(

0 commit comments

Comments
 (0)