2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

restore: don't leak a transport socket

CID 73354 (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_handle: Handle variable sock going out of scope leaks the handle

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2014-10-31 17:50:46 +03:00 committed by Pavel Emelyanov
parent 80f9494d25
commit a19e945f6e

View File

@ -749,18 +749,21 @@ static int open_transport_fd(int pid, struct fdinfo_list_entry *fle)
ret = bind(sock, &saddr, sun_len);
if (ret < 0) {
pr_perror("Can't bind unix socket %s", saddr.sun_path + 1);
return -1;
goto err;
}
ret = reopen_fd_as(fle->fe->fd, sock);
if (ret < 0)
return -1;
goto err;
pr_info("\t\tWake up fdinfo pid=%d fd=%d\n", fle->pid, fle->fe->fd);
futex_set_and_wake(&fle->real_pid, getpid());
want_recv_stage();
return 0;
err:
close(sock);
return -1;
}
int send_fd_to_peer(int fd, struct fdinfo_list_entry *fle, int sock)