]> xenbits.xensource.com Git - libvirt.git/commitdiff
uml: Fix umlProcessAutoDestroyDom dom processing
authorJohn Ferlan <jferlan@redhat.com>
Tue, 27 Mar 2018 14:18:06 +0000 (10:18 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 19 Apr 2018 18:42:59 +0000 (14:42 -0400)
There's no need to check if @dom exists before trying to
call virDomainObjListRemove since it must exist due to
prior checks.

Additionally, if we do remove the @dom, then set it to NULL
so that the virObjectUnlock isn't referencing something that
is deleted.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/uml/uml_driver.c

index 56dfd7b581fd2948ab355ca346448931464a360e..23d09891f4771d56ce2671fa4bfd8bfc1ca4d84f 100644 (file)
@@ -747,8 +747,10 @@ static int umlProcessAutoDestroyDom(void *payload,
                                      VIR_DOMAIN_EVENT_STOPPED,
                                      VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
 
-    if (dom && !dom->persistent)
+    if (!dom->persistent) {
         virDomainObjListRemove(data->driver->domains, dom);
+        dom = NULL;
+    }
 
     if (dom)
         virObjectUnlock(dom);