[CRIU] [PATCH v4 1/3] proc_parce: Fix assignment of ns_mountpoint

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jul 20 03:13:03 PDT 2016


realloc() may move a memory chunk in case of shrink.

v4: New
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/proc_parse.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index c0e0861..b5106c6 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -1285,7 +1285,6 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
 	new->mountpoint = xmalloc(PATH_MAX);
 	if (new->mountpoint == NULL)
 		goto err;
-	new->ns_mountpoint = new->mountpoint;
 
 	new->mountpoint[0] = '.';
 	ret = sscanf(str, "%i %i %u:%u %ms %s %ms %n",
@@ -1308,6 +1307,7 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
 	new->mountpoint = xrealloc(new->mountpoint, strlen(new->mountpoint) + 1);
 	if (!new->mountpoint)
 		goto err;
+	new->ns_mountpoint = new->mountpoint;
 
 	new->s_dev = new->s_dev_rt = MKKDEV(kmaj, kmin);
 	new->flags = 0;



More information about the CRIU mailing list