mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 18:14:15 +00:00
Use correct return when clone fails
When the clone failed we tried to destroy the container. This will lead to a segfault. Instead simply return -1. Also move the call to free_mnts() after the put label to free the user specified mounts even when we just goto put. Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
2b47bac3f8
commit
dca0532e37
@ -388,7 +388,7 @@ static int do_clone_ephemeral(struct lxc_container *c,
|
|||||||
clone = c->clone(c, my_args->newname, my_args->newpath, flags,
|
clone = c->clone(c, my_args->newname, my_args->newpath, flags,
|
||||||
my_args->bdevtype, NULL, my_args->fssize, args);
|
my_args->bdevtype, NULL, my_args->fssize, args);
|
||||||
if (!clone)
|
if (!clone)
|
||||||
goto err;
|
return -1;
|
||||||
|
|
||||||
if (!my_args->keepdata)
|
if (!my_args->keepdata)
|
||||||
if (!clone->set_config_item(clone, "lxc.ephemeral", "1"))
|
if (!clone->set_config_item(clone, "lxc.ephemeral", "1"))
|
||||||
@ -439,9 +439,9 @@ static int do_clone_ephemeral(struct lxc_container *c,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
free_mnts(mnts, num);
|
|
||||||
clone->destroy(clone);
|
clone->destroy(clone);
|
||||||
put:
|
put:
|
||||||
|
free_mnts(mnts, num);
|
||||||
lxc_container_put(clone);
|
lxc_container_put(clone);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user