[CRIU] [PATCH] remap: don't free rpath and don't shfree_last gf

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Dec 1 13:09:55 MSK 2017


a) As we shmalloced rpath it can not be xfreed. b) As we shmalloc
variables in collect_remap_ghost() far away from open_remap_ghost()
where we want to free them, there is no guaranty that our shmalloc was
last and we can't use shfree_last().

fixes commit 0c675a5e9d40 ("files: remove link_remaps when everything
has been restored")

When create_ghost() fails for some reason that produces a segfault for me.

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 criu/files-reg.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 9f5462cd0..07b0bc4e5 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -503,8 +503,6 @@ static int open_remap_ghost(struct reg_file_info *rfi,
 err:
 	if (gfe)
 		ghost_file_entry__free_unpacked(gfe, NULL);
-	xfree(gf->remap.rpath);
-	shfree_last(gf);
 	return -1;
 }
 
-- 
2.13.6



More information about the CRIU mailing list