1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

vboxDumpSharedFolders: return a value

The allocation errors in this function are already handled by jumping
to a cleanup label.

Change the return type from void to int and return -1 on error.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Ján Tomko 2018-01-31 16:11:18 +01:00
parent bfdc62e415
commit c94bb0427b

View File

@ -3627,19 +3627,23 @@ vboxDumpDisplay(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
return ret;
}
static void
static int
vboxDumpSharedFolders(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
{
vboxArray sharedFolders = VBOX_ARRAY_INITIALIZER;
size_t i = 0;
int ret = -1;
def->nfss = 0;
gVBoxAPI.UArray.vboxArrayGet(&sharedFolders, machine,
gVBoxAPI.UArray.handleMachineGetSharedFolders(machine));
if (sharedFolders.count <= 0)
if (sharedFolders.count <= 0) {
if (sharedFolders.count == 0)
ret = 0;
goto cleanup;
}
if (VIR_ALLOC_N(def->fss, sharedFolders.count) < 0)
goto cleanup;
@ -3683,8 +3687,11 @@ vboxDumpSharedFolders(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine
++def->nfss;
}
ret = 0;
cleanup:
gVBoxAPI.UArray.vboxArrayRelease(&sharedFolders);
return ret;
}
static void
@ -4179,7 +4186,8 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
if (vboxDumpDisks(def, data, machine) < 0)
goto cleanup;
vboxDumpSharedFolders(def, data, machine);
if (vboxDumpSharedFolders(def, data, machine) < 0)
goto cleanup;
vboxDumpNetwork(def, data, machine, networkAdapterCount);
vboxDumpAudio(def, data, machine);