From: John Ferlan Date: Thu, 28 Aug 2014 16:49:30 +0000 (-0400) Subject: qemu_driver: Resolve Coverity FORWARD_NULL X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5c0dad7b39c3e52a2336ae0e7c982bb0c6da250d;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git qemu_driver: Resolve Coverity FORWARD_NULL In qemuDomainSnapshotCreateDiskActive() if we jumped to cleanup from a failed actions = virJSONValueNewArray(), then 'cfg' would be NULL. So just return -1, which in turn removes the need for cleanup: --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5d2108092..239a3009e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13023,7 +13023,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { if (!(actions = virJSONValueNewArray())) - goto cleanup; + return -1; } else if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DISK_SNAPSHOT)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("live disk snapshot not supported with this " @@ -13106,7 +13106,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, } } - cleanup: /* recheck backing chains of all disks involved in the snapshot */ orig_err = virSaveLastError(); for (i = 0; i < snap->def->ndisks; i++) {