c->lxc_conf cannot be NULL in this case since the call sequence c->save_config() c->load_config() load_config_locked() which is done before this check will allocate it or fail
Signed-off-by: Dwight Engen <dwight.en...@oracle.com> --- src/lxc/lxccontainer.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 680b536..1254dc0 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -1128,24 +1128,22 @@ static bool lxcapi_create(struct lxc_container *c, const char *t, goto out; } - if (c->lxc_conf) { - /* - * either template or rootfs.path should be set. - * if both template and rootfs.path are set, template is setup as rootfs.path. - * container is already created if we have a config and rootfs.path is accessible - */ - if (!c->lxc_conf->rootfs.path && !tpath) - /* no template passed in and rootfs does not exist: error */ - goto out; - if (c->lxc_conf->rootfs.path && access(c->lxc_conf->rootfs.path, F_OK) != 0) - /* rootfs passed into configuration, but does not exist: error */ - goto out; - if (lxcapi_is_defined(c) && c->lxc_conf->rootfs.path && !tpath) { - /* Rootfs already existed, user just wanted to save the - * loaded configuration */ - ret = true; - goto out; - } + /* + * either template or rootfs.path should be set. + * if both template and rootfs.path are set, template is setup as rootfs.path. + * container is already created if we have a config and rootfs.path is accessible + */ + if (!c->lxc_conf->rootfs.path && !tpath) + /* no template passed in and rootfs does not exist: error */ + goto out; + if (c->lxc_conf->rootfs.path && access(c->lxc_conf->rootfs.path, F_OK) != 0) + /* rootfs passed into configuration, but does not exist: error */ + goto out; + if (lxcapi_is_defined(c) && c->lxc_conf->rootfs.path && !tpath) { + /* Rootfs already existed, user just wanted to save the + * loaded configuration */ + ret = true; + goto out; } /* Mark that this container is being created */ -- 1.8.3.1 ------------------------------------------------------------------------------ Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel