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 */
|
/* Allocate mem, if fails return error */
|
||||||
if (VIR_ALLOC_N(defdom->disks, defdom->ndisks) >= 0) {
|
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 {
|
|
||||||
goto cleanup;
|
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 */
|
/* get the attachment details here */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user