[CRIU] [PATCH 01/18] unix: fix a memory leak

Andrei Vagin avagin at openvz.org
Thu Nov 9 22:20:55 MSK 2017


From: Andrei Vagin <avagin at virtuozzo.com>

CID 185305 (#1 of 1): Resource leak (RESOURCE_LEAK)
23. leaked_storage: Variable sfle going out of scope leaks the storage it points to.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/sk-unix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 3963a4ad5..4bf9c8e6a 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -938,6 +938,7 @@ int unix_note_scm_rights(int id_for, uint32_t *file_ids, int *fds, int n_ids)
 
 		sfle->fle = get_fle_for_scm(tgt, owner);
 		if (!sfle->fle) {
+			xfree(sfle);
 			pr_err("Can't request new fle for scm\n");
 			return -1;
 		}
-- 
2.13.6



More information about the CRIU mailing list