2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

files: don't leak a socket in error cases

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

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Andrei Vagin
2016-12-09 00:50:00 +03:00
committed by Pavel Emelyanov
parent 65d79e9482
commit 3bdcd52f4e

View File

@@ -1683,6 +1683,7 @@ int open_transport_socket(void)
transport_name_gen(&saddr, &slen, pid, -1);
if (bind(sock, (struct sockaddr *)&saddr, slen) < 0) {
pr_perror("Can't bind transport socket %s", saddr.sun_path + 1);
close(sock);
return -1;
}