Commit 90891588 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mnt: Sanitize collect mntinfo error path

Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f818065e
......@@ -813,9 +813,20 @@ static int dump_one_mountpoint(struct mount_info *pm, int fd)
return 0;
}
static void free_mntinfo(struct mount_info *pms)
{
while (pms) {
struct mount_info *pm;
pm = pms->next;
mnt_entry_free(pms);
pms = pm;
}
}
struct mount_info *collect_mntinfo(struct ns_id *ns)
{
struct mount_info *pm, *p;
struct mount_info *pm;
if (mntns_collect_root(ns->pid) < 0)
return NULL;
......@@ -832,14 +843,7 @@ struct mount_info *collect_mntinfo(struct ns_id *ns)
return pm;
err:
while (pm) {
p = pm;
pm = pm->next;
xfree(p);
}
ns->mnt.mntinfo_tree = NULL;
free_mntinfo(pm);
return NULL;
}
......@@ -1378,17 +1382,6 @@ void mnt_entry_free(struct mount_info *mi)
xfree(mi);
}
static void free_mntinfo(struct mount_info *pms)
{
while (pms) {
struct mount_info *pm;
pm = pms->next;
mnt_entry_free(pms);
pms = pm;
}
}
/*
* mnt_roots is a temporary directory for restoring sub-trees of
* non-root namespaces.
......
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