]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
xenapi: Resolve Coverity NULL_RETURNS
authorJohn Ferlan <jferlan@redhat.com>
Tue, 10 Mar 2015 22:52:07 +0000 (18:52 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 11 Mar 2015 17:02:36 +0000 (13:02 -0400)
Coverity points out that the return from virDomainDefParseString is
not checked in xenapiDomainCreateXML like it should be which could
end up in a NULL pointer dereference

src/xenapi/xenapi_driver.c

index 821e9d94cec3cbd903e46e2a09c93341f763c660..148ff9bd8cc8f2802fae4cbdec08b2b88918a8c5 100644 (file)
@@ -560,6 +560,8 @@ xenapiDomainCreateXML(virConnectPtr conn,
                                                      priv->caps, priv->xmlopt,
                                                      1 << VIR_DOMAIN_VIRT_XEN,
                                                      parse_flags);
+    if (!defPtr)
+        return NULL;
     createVMRecordFromXml(conn, defPtr, &record, &vm);
     virDomainDefFree(defPtr);
     if (record) {