[CRIU] [PATCH] page-server: don't forget to close a sever socket

Andrey Vagin avagin at openvz.org
Fri Oct 31 15:00:28 PDT 2014


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

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 page-xfer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/page-xfer.c b/page-xfer.c
index c3faf90..05176ad 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -307,8 +307,9 @@ int cr_page_server(bool daemon_mode, int cfd)
 no_server:
 	if (daemon_mode) {
 		ret = cr_daemon(1, 0, &ask, cfd);
+		close_safe(&sk);
 		if (ret == -1) {
-			pr_perror("Can't run in the background");
+			pr_err("Can't run in the background\n");
 			goto out;
 		}
 		if (ret > 0) { /* parent task, daemon started */
-- 
1.9.3



More information about the CRIU mailing list