[CRIU] [PATCH 9/9] namespaces: close fd on the source netns in restore_ns

Andrey Vagin avagin at openvz.org
Thu Apr 4 17:44:35 EDT 2013


It's opened in switch_ns.

CID 996194 (#3 of 5): Resource leak (RESOURCE_LEAK)
11. leaked_handle: Handle variable rst going out of scope leaks the handle.

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

diff --git a/namespaces.c b/namespaces.c
index 9adaf31..168f945 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -58,6 +58,8 @@ int restore_ns(int rst, struct ns_desc *nd)
 	if (ret < 0)
 		pr_perror("Can't restore ns back");
 
+	close(rst);
+
 	return ret;
 }
 
-- 
1.7.11.7



More information about the CRIU mailing list