mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-16 18:25:08 -06:00
vbox: Don't leak domain names in vboxListDefinedDomains
This commit is contained in:
parent
8c572b6c78
commit
80d80fed9e
@ -3112,13 +3112,17 @@ static int vboxListDefinedDomains(virConnectPtr conn, char ** const names, int m
|
|||||||
|| (state > MachineState_LastOnline) ) {
|
|| (state > MachineState_LastOnline) ) {
|
||||||
machine->vtbl->GetName(machine, &machineNameUtf16);
|
machine->vtbl->GetName(machine, &machineNameUtf16);
|
||||||
VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
|
VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
|
||||||
if (!(names[j++] = strdup(machineName))) {
|
names[j] = strdup(machineName);
|
||||||
|
VBOX_UTF16_FREE(machineNameUtf16);
|
||||||
|
VBOX_UTF8_FREE(machineName);
|
||||||
|
if (!names[j]) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
for ( ; j >= 0 ; j--)
|
for ( ; j >= 0 ; j--)
|
||||||
VIR_FREE(names[j]);
|
VIR_FREE(names[j]);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
j++;
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3126,8 +3130,6 @@ static int vboxListDefinedDomains(virConnectPtr conn, char ** const names, int m
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VBOX_UTF8_FREE(machineName);
|
|
||||||
VBOX_UTF16_FREE(machineNameUtf16);
|
|
||||||
vboxArrayRelease(&machines);
|
vboxArrayRelease(&machines);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user