[CRIU] [PATCH 1/2] files-reg: don't leak file_remap objects on error paths

Andrey Vagin avagin at openvz.org
Thu Oct 29 05:29:25 PDT 2015


From: Andrew Vagin <avagin at openvz.org>

CID undefined (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_storage: Variable rm going out of scope leaks the storage it points to.

Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 files-reg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/files-reg.c b/files-reg.c
index 59d88ca..597d9ae 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -264,6 +264,7 @@ static int open_remap_linked(struct reg_file_info *rfi,
 		rfd = mntns_get_root_by_mnt_id(rfi->rfe->mnt_id);
 		if (fstatat(rfd, rrfi->path, &st, AT_SYMLINK_NOFOLLOW)) {
 			pr_perror("Can't get owner of link remap %s", rrfi->path);
+			xfree(rm);
 			return -1;
 		}
 
-- 
2.4.3



More information about the CRIU mailing list