[CRIU] [PATCH] tcp: don't leak a file descriptor

Andrey Vagin avagin at openvz.org
Thu Aug 4 15:52:44 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

CID 164719 (#1 of 1): Resource leak (RESOURCE_LEAK)
7. leaked_handle: Handle variable sk going out of scope leaks the handle.

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/sk-tcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index ae1d8a2..86534a4 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -840,6 +840,7 @@ int kerndat_tcp_repair_window()
 		if (errno == EPERM) {
 			kdat.has_tcp_window = false;
 			pr_warn("TCP_REPAIR isn't available to unprivileged users\n");
+			close(sk);
 			return 0;
 		}
 		pr_perror("Unable to set TCP_REPAIR");
-- 
2.7.4



More information about the CRIU mailing list