selftests/bpf: fix double bpf_object__close() in veristate
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 21 Sep 2022 16:42:51 +0000 (09:42 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 22 Sep 2022 02:41:37 +0000 (19:41 -0700)
bpf_object__close(obj) is called twice for BPF object files with single
BPF program in it. This causes crash. Fix this by not calling
bpf_object__close() unnecessarily.

Fixes: c8bc5e050976 ("selftests/bpf: Add veristat tool for mass-verifying BPF object files")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20220921164254.3630690-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/veristat.c

index 39e6dc4..c0c8a65 100644 (file)
@@ -300,7 +300,6 @@ static int process_obj(const char *filename)
                prog = bpf_object__next_program(obj, NULL);
                bpf_program__set_autoload(prog, true);
                process_prog(filename, obj, prog);
-               bpf_object__close(obj);
                goto cleanup;
        }