mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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:
This commit is contained in:
parent
e387f4c1f1
commit
5c0dad7b39
@ -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,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user