Commit c9b9aad2 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: rollback and return a negative value in case of errors

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent caa1c406
...@@ -653,10 +653,9 @@ static int populate_mnt_ns(int ns_pid) ...@@ -653,10 +653,9 @@ static int populate_mnt_ns(int ns_pid)
if (ret <= 0) if (ret <= 0)
break; break;
ret = -1;
pm = xmalloc(sizeof(*pm)); pm = xmalloc(sizeof(*pm));
if (!pm) if (!pm)
break; goto err;
mnt_entry_init(pm); mnt_entry_init(pm);
...@@ -705,6 +704,11 @@ static int populate_mnt_ns(int ns_pid) ...@@ -705,6 +704,11 @@ static int populate_mnt_ns(int ns_pid)
return mnt_tree_for_each(pms, do_mount_one); return mnt_tree_for_each(pms, do_mount_one);
err: err:
while (pms) {
struct mount_info *pm = pms;
pms = pm->next;
xfree(pm);
}
close_safe(&img); close_safe(&img);
return -1; return -1;
} }
......
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