]> xenbits.xensource.com Git - libvirt.git/commitdiff
xen: Resolve Coverity FORWARD_NULL issue
authorJohn Ferlan <jferlan@redhat.com>
Thu, 23 May 2013 15:07:36 +0000 (11:07 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 23 May 2013 23:19:21 +0000 (19:19 -0400)
Commit '18b14012' refactored the Xen code resulting in a Coverity
warning about possible NULL reference if the path where the XM driver
takes puts the def on it's list.  Moved/duplicated the virGetDomain()
call to pacify the possible NULL deref.

src/xen/xen_driver.c

index 61bd584069326cda6665ec87660f5b3945028477..217d38096c1d49debb09824d1e1ab9934cb41456 100644 (file)
@@ -1656,13 +1656,14 @@ xenUnifiedDomainDefineXML(virConnectPtr conn, const char *xml)
     if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
         if (xenXMDomainDefineXML(conn, def) < 0)
             goto cleanup;
+        ret = virGetDomain(conn, def->name, def->uuid);
         def = NULL; /* XM driver owns it now */
     } else {
         if (xenDaemonDomainDefineXML(conn, def) < 0)
             goto cleanup;
+        ret = virGetDomain(conn, def->name, def->uuid);
     }
 
-    ret = virGetDomain(conn, def->name, def->uuid);
     if (ret)
         ret->id = -1;