]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Free the allocated resources after test case succeeds
authorHou Tao <houtao1@huawei.com>
Wed, 21 Sep 2022 07:00:35 +0000 (15:00 +0800)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 22 Sep 2022 23:41:27 +0000 (16:41 -0700)
commit83931f28b0357acf358288d51703388a63272a53
treec54832297ee526b06e635e3b6fb1345d83913689
parent6277f98b43aad08bef8265d48618d3ce615eef39
selftests/bpf: Free the allocated resources after test case succeeds

Free the created fd or allocated bpf_object after test case succeeds,
else there will be resource leaks.

Spotted by using address sanitizer and checking the content of
/proc/$pid/fd directory.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20220921070035.2016413-3-houtao@huaweicloud.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c
tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c
tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c
tools/testing/selftests/bpf/test_maps.c