Skip to content

Commit

Permalink
selftests/bpf: Close obj in error path in xdp_adjust_tail
Browse files Browse the repository at this point in the history
If bpf_object__load() fails in test_xdp_adjust_frags_tail_grow(), "obj"
opened before this should be closed. So use "goto out" to close it instead
of using "return" here.

Fixes: 1102210 ("bpf: selftests: update xdp_adjust_tail selftest to include xdp frags")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Link: https://lore.kernel.org/r/f282a1ed2d0e3fb38cceefec8e81cabb69cab260.1720615848.git.tanggeliang@kylinos.cn
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
  • Loading branch information
Geliang Tang authored and Martin KaFai Lau committed Jul 10, 2024
1 parent eef0532 commit 52b49ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void test_xdp_adjust_frags_tail_grow(void)

prog = bpf_object__next_program(obj, NULL);
if (bpf_object__load(obj))
return;
goto out;

prog_fd = bpf_program__fd(prog);

Expand Down

0 comments on commit 52b49ec

Please sign in to comment.