Commit 227ffd3e authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

proc_parce: Fix assignment of ns_mountpoint

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

v4: New
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 9c7a234b
...@@ -1285,7 +1285,6 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname) ...@@ -1285,7 +1285,6 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
new->mountpoint = xmalloc(PATH_MAX); new->mountpoint = xmalloc(PATH_MAX);
if (new->mountpoint == NULL) if (new->mountpoint == NULL)
goto err; goto err;
new->ns_mountpoint = new->mountpoint;
new->mountpoint[0] = '.'; new->mountpoint[0] = '.';
ret = sscanf(str, "%i %i %u:%u %ms %s %ms %n", 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) ...@@ -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); new->mountpoint = xrealloc(new->mountpoint, strlen(new->mountpoint) + 1);
if (!new->mountpoint) if (!new->mountpoint)
goto err; goto err;
new->ns_mountpoint = new->mountpoint;
new->s_dev = new->s_dev_rt = MKKDEV(kmaj, kmin); new->s_dev = new->s_dev_rt = MKKDEV(kmaj, kmin);
new->flags = 0; new->flags = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment