selftests/bpf: Fix bpf_link leak in ns_current_pid_tgid selftest
If condition is inverted, but it's also just not necessary.
Fixes: 1c1052e014
("tools/testing/selftests/bpf: Add self-tests for new helper bpf_get_ns_current_pid_tgid.")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Cc: Carlos Neira <cneirabustos@gmail.com>
Link: https://lore.kernel.org/bpf/20200429012111.277390-11-andriin@fb.com
This commit is contained in:

committed by
Alexei Starovoitov

parent
36d0b6159f
commit
8d30e80a04
@@ -80,9 +80,6 @@ void test_ns_current_pid_tgid(void)
|
||||
"User pid/tgid %llu BPF pid/tgid %llu\n", id, bss.pid_tgid))
|
||||
goto cleanup;
|
||||
cleanup:
|
||||
if (!link) {
|
||||
bpf_link__destroy(link);
|
||||
link = NULL;
|
||||
}
|
||||
bpf_link__destroy(link);
|
||||
bpf_object__close(obj);
|
||||
}
|
||||
|
Reference in New Issue
Block a user