[CRIU] [PATCH] files: don't leak a file descriptor
Andrei Vagin
avagin at openvz.org
Thu Jan 5 09:47:57 PST 2017
From: Andrei Vagin <avagin at virtuozzo.com>
CID 173737 (#1 of 2): Resource leak (RESOURCE_LEAK)
9. leaked_handle: Handle variable rmntns_root going out of scope leaks the handle.
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
criu/files-reg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/criu/files-reg.c b/criu/files-reg.c
index f022a99..73a1838 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -540,9 +540,11 @@ static int clean_linked_remap(struct remap_info *ri)
ret = unlinkat(rmntns_root, remap->rpath, remap->is_dir ? AT_REMOVEDIR : 0);
if (ret < 0) {
+ close(rmntns_root);
pr_perror("Couldn't unlink remap %d %s", rmntns_root, remap->rpath);
return -1;
}
+ close(rmntns_root);
remap->rpath[0] = 0;
return 0;
--
2.7.4
More information about the CRIU
mailing list