mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
vbox: invert condition in vboxSnapshotGetReadOnlyDisks
Error out on (impossible) failed allocation, to reduce indentation. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
4a1f4e898b
commit
5ee7714b57
@ -5971,15 +5971,14 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDefPtr def,
|
||||
}
|
||||
|
||||
/* Allocate mem, if fails return error */
|
||||
if (VIR_ALLOC_N(defdom->disks, defdom->ndisks) >= 0) {
|
||||
for (i = 0; i < defdom->ndisks; i++) {
|
||||
virDomainDiskDefPtr diskDef = virDomainDiskDefNew(NULL);
|
||||
if (!diskDef)
|
||||
goto cleanup;
|
||||
defdom->disks[i] = diskDef;
|
||||
}
|
||||
} else {
|
||||
if (VIR_ALLOC_N(defdom->disks, defdom->ndisks) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0; i < defdom->ndisks; i++) {
|
||||
virDomainDiskDefPtr diskDef = virDomainDiskDefNew(NULL);
|
||||
if (!diskDef)
|
||||
goto cleanup;
|
||||
defdom->disks[i] = diskDef;
|
||||
}
|
||||
|
||||
/* get the attachment details here */
|
||||
|
Loading…
x
Reference in New Issue
Block a user