(Except in cases where we will immediately exit)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
// First try mounting rootfs using a bdev
struct bdev *bdev = bdev_init(rootfs->path, rootfs->mount, NULL);
if (bdev && bdev->ops->mount(bdev) == 0) {
+ bdev_put(bdev);
DEBUG("mounted '%s' on '%s'", rootfs->path, rootfs->mount);
return 0;
}
+ if (bdev)
+ bdev_put(bdev);
if (mount_rootfs(rootfs->path, rootfs->mount)) {
ERROR("failed to mount rootfs");
return -1;
r = bdev_init(c->lxc_conf->rootfs.path, c->lxc_conf->rootfs.mount, NULL);
if (r) {
if (r->ops->destroy(r) < 0) {
+ bdev_put(r);
ERROR("Error destroying rootfs for %s", c->name);
goto out;
}
+ bdev_put(r);
}
mod_all_rdeps(c, false);