[CRIU] [PATCH 05/13] mount: rollback and return a negative value in case of errors
Andrey Vagin
avagin at openvz.org
Wed Apr 3 13:31:04 EDT 2013
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
mount.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mount.c b/mount.c
index ce02680..3737d7a 100644
--- a/mount.c
+++ b/mount.c
@@ -653,10 +653,9 @@ static int populate_mnt_ns(int ns_pid)
if (ret <= 0)
break;
- ret = -1;
pm = xmalloc(sizeof(*pm));
if (!pm)
- break;
+ goto err;
mnt_entry_init(pm);
@@ -705,6 +704,11 @@ static int populate_mnt_ns(int ns_pid)
return mnt_tree_for_each(pms, do_mount_one);
err:
+ while (pms) {
+ struct mount_info *pm = pms;
+ pms = pm->next;
+ xfree(pm);
+ }
close_safe(&img);
return -1;
}
--
1.7.11.7
More information about the CRIU
mailing list