Skip to content

Commit

Permalink
selftests/bpf: Fix bpf_object leak in skb_ctx selftest
Browse files Browse the repository at this point in the history
skb_ctx selftest didn't close bpf_object implicitly allocated by
bpf_prog_test_load() helper. Fix the problem by explicitly calling
bpf_object__close() at the end of the test.

Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Reviewed-by: Hengqi Chen <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
anakryiko authored and Alexei Starovoitov committed Nov 7, 2021
1 parent f91231e commit 8c7a955
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/testing/selftests/bpf/prog_tests/skb_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ void test_skb_ctx(void)
"ctx_out_mark",
"skb->mark == %u, expected %d\n",
skb.mark, 10);

bpf_object__close(obj);
}

0 comments on commit 8c7a955

Please sign in to comment.