From 3bdcd52f4e150dcfbf528efb12cf7a299eae7d1c Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 9 Dec 2016 00:50:00 +0300 Subject: [PATCH] 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 Signed-off-by: Pavel Emelyanov --- criu/files.c | 1 + 1 file changed, 1 insertion(+) diff --git a/criu/files.c b/criu/files.c index 12cc88df8..f77cf1192 100644 --- a/criu/files.c +++ b/criu/files.c @@ -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; }