From 5c0dad7b39c3e52a2336ae0e7c982bb0c6da250d Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Thu, 28 Aug 2014 12:49:30 -0400 Subject: [PATCH] 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: --- src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5d2108092b..239a3009ed 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++) {