From: Andrii Nakryiko Date: Sun, 7 Nov 2021 16:55:21 +0000 (-0800) Subject: selftests/bpf: Fix bpf_object leak in skb_ctx selftest X-Git-Tag: v5.17-rc1~170^2~445^2~15^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c7a95520184b6677ca6075e12df9c208d57d088;p=thirdparty%2Fkernel%2Flinux.git selftests/bpf: Fix bpf_object leak in skb_ctx selftest 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 Signed-off-by: Alexei Starovoitov Reviewed-by: Hengqi Chen Link: https://lore.kernel.org/bpf/20211107165521.9240-10-andrii@kernel.org --- diff --git a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c index d3106078838c4..b5319ba2ee279 100644 --- a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c +++ b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c @@ -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); }