]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_driver: Resolve Coverity FORWARD_NULL
authorJohn Ferlan <jferlan@redhat.com>
Thu, 28 Aug 2014 16:49:30 +0000 (12:49 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 28 Aug 2014 23:18:52 +0000 (19:18 -0400)
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:

src/qemu/qemu_driver.c

index 5d2108092bbb4c8bf635451fddc84e7b835e0561..239a3009ed4fc01b3570f06b8636b9655457a87f 100644 (file)
@@ -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++) {