提交 5c0dad7b 编写于 作者: J John Ferlan

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:
上级 e387f4c1
...@@ -13023,7 +13023,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -13023,7 +13023,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
if (!(actions = virJSONValueNewArray())) if (!(actions = virJSONValueNewArray()))
goto cleanup; return -1;
} else if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DISK_SNAPSHOT)) { } else if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DISK_SNAPSHOT)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("live disk snapshot not supported with this " _("live disk snapshot not supported with this "
...@@ -13106,7 +13106,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, ...@@ -13106,7 +13106,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
} }
} }
cleanup:
/* recheck backing chains of all disks involved in the snapshot */ /* recheck backing chains of all disks involved in the snapshot */
orig_err = virSaveLastError(); orig_err = virSaveLastError();
for (i = 0; i < snap->def->ndisks; i++) { for (i = 0; i < snap->def->ndisks; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册