mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +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:
committed by
Pavel Emelyanov
parent
65d79e9482
commit
3bdcd52f4e
@@ -1683,6 +1683,7 @@ int open_transport_socket(void)
|
|||||||
transport_name_gen(&saddr, &slen, pid, -1);
|
transport_name_gen(&saddr, &slen, pid, -1);
|
||||||
if (bind(sock, (struct sockaddr *)&saddr, slen) < 0) {
|
if (bind(sock, (struct sockaddr *)&saddr, slen) < 0) {
|
||||||
pr_perror("Can't bind transport socket %s", saddr.sun_path + 1);
|
pr_perror("Can't bind transport socket %s", saddr.sun_path + 1);
|
||||||
|
close(sock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user