]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: Fix lxcDomainDestroyFlags endjob processing
authorJohn Ferlan <jferlan@redhat.com>
Fri, 20 May 2016 12:42:29 +0000 (08:42 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 25 May 2016 10:02:42 +0000 (06:02 -0400)
Commit id '15ccb0dbf' added job functions for the lxc driver; however,
for shutdown and nonpersistent path, the vm was removed from the domain
object list and the vm pointer cleared before the endjob.

Adjust the code to perform the endjob first and then perform the
ObjListRemove as long as the vm wasn't NULL. This follows more closely
models from qemu and libxl

Found by Coverity (FORWARD_NULL)

src/lxc/lxc_driver.c

index d6908864be075bf7f8719fed22fba2616bdf2290..9e03f1f62e06c70d211d13f9a4905778e3b28c54 100644 (file)
@@ -1541,13 +1541,11 @@ lxcDomainDestroyFlags(virDomainPtr dom,
                                      VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
     priv->doneStopEvent = true;
     virDomainAuditStop(vm, "destroyed");
-    if (!vm->persistent) {
-        virDomainObjListRemove(driver->domains, vm);
-        vm = NULL;
-    }
 
  endjob:
     virLXCDomainObjEndJob(driver, vm);
+    if (!vm->persistent)
+        virDomainObjListRemove(driver->domains, vm);
 
  cleanup:
     virDomainObjEndAPI(&vm);