selftests/bpf: test_progs: Don't leak server_fd in test_sockopt_inherit

server_fd needs to be closed if pthread can't be created.

Fixes: e3e02e1d9c ("selftests/bpf: test_progs: convert test_sockopt_inherit")
Signed-off-by: Brian Vazquez <brianvv@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/20191001173728.149786-3-brianvv@google.com
This commit is contained in:
Brian Vazquez 2019-10-01 10:37:28 -07:00 committed by Daniel Borkmann
parent 86c1aea84b
commit a2d074e4c6

View File

@ -195,7 +195,7 @@ static void run_test(int cgroup_fd)
if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread,
(void *)&server_fd)))
goto close_bpf_object;
goto close_server_fd;
pthread_mutex_lock(&server_started_mtx);
pthread_cond_wait(&server_started, &server_started_mtx);