mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-14 05:33:39 +00:00
don't dereference a NULL c->lxc_conf
Commit 37cf711b
added a destroy hook, but when it checks
at destroy time whether that hook exists, it assumes that
c->lxc_conf is good. In fact lxc_conf can be NULL, so check
for that.
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
755fa45300
commit
a70a69e8a0
@ -2160,11 +2160,12 @@ static bool container_destroy(struct lxc_container *c)
|
|||||||
{
|
{
|
||||||
bool bret = false;
|
bool bret = false;
|
||||||
int ret;
|
int ret;
|
||||||
struct lxc_conf *conf = c->lxc_conf;
|
struct lxc_conf *conf;
|
||||||
|
|
||||||
if (!c || !do_lxcapi_is_defined(c))
|
if (!c || !do_lxcapi_is_defined(c))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
conf = c->lxc_conf;
|
||||||
if (container_disk_lock(c))
|
if (container_disk_lock(c))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2174,7 +2175,7 @@ static bool container_destroy(struct lxc_container *c)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lxc_list_empty(&conf->hooks[LXCHOOK_DESTROY])) {
|
if (conf && !lxc_list_empty(&conf->hooks[LXCHOOK_DESTROY])) {
|
||||||
/* Start of environment variable setup for hooks */
|
/* Start of environment variable setup for hooks */
|
||||||
if (setenv("LXC_NAME", c->name, 1)) {
|
if (setenv("LXC_NAME", c->name, 1)) {
|
||||||
SYSERROR("failed to set environment variable for container name");
|
SYSERROR("failed to set environment variable for container name");
|
||||||
|
Loading…
Reference in New Issue
Block a user