From 227ffd3e40db5dba63ee47523e6f07a5ad8fd8ac Mon Sep 17 00:00:00 2001 From: Kirill Tkhai Date: Wed, 20 Jul 2016 13:13:03 +0300 Subject: [PATCH] proc_parce: Fix assignment of ns_mountpoint realloc() may move a memory chunk in case of shrink. v4: New Signed-off-by: Kirill Tkhai Signed-off-by: Pavel Emelyanov --- 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 c0e0861e5..b5106c690 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;