[PATCH] xen: Resolve Coverity FORWARD_NULL issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

NOTE: I did ping Dan B, but he is away, so rather than wait or take
the chance this ends up in the upcoming release, I made the change.

---
 src/xen/xen_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index cc6e486..9eab3fc 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1658,13 +1658,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;
 
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]