[CRIU] [PATCH] files-reg: don't leak a file descriptor
Andrey Vagin
avagin at openvz.org
Wed Nov 25 22:19:49 PST 2015
From: Andrew Vagin <avagin at virtuozzo.com>
CID 154850 (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_handle: Handle variable cwd_fd going out of scope leaks the handle.
Reported-by: coverity
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
files-reg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/files-reg.c b/files-reg.c
index 8494a6d..425dc04 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -471,6 +471,7 @@ void try_clean_remaps(int ns_fd)
if (setns(ns_fd, CLONE_NEWNS) < 0) {
close(old_ns);
+ close(cwd_fd);
pr_perror("`- Can't switch");
return;
}
--
2.4.3
More information about the CRIU
mailing list