mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
vbox: fix VIR_STRDUP value check
In my review of 31532ca I missed the fact that VIR_STRDUP now returns 1 on success, and 0 if the source was NULL. (This still doesn't add proper OOM error handling.)
This commit is contained in:
parent
ba0880b25c
commit
1c65362f11
@ -2688,8 +2688,8 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
|
|||||||
|
|
||||||
if (hddType == HardDiskType_Immutable)
|
if (hddType == HardDiskType_Immutable)
|
||||||
def->disks[hddNum]->readonly = true;
|
def->disks[hddNum]->readonly = true;
|
||||||
if (VIR_STRDUP_QUIET(def->disks[hddNum]->src, hddlocation) == 0 &&
|
ignore_value(VIR_STRDUP(def->disks[hddNum]->src, hddlocation));
|
||||||
VIR_STRDUP_QUIET(def->disks[hddNum]->dst, "hdd") == 0)
|
ignore_value(VIR_STRDUP(def->disks[hddNum]->dst, "hdd"));
|
||||||
hddNum++;
|
hddNum++;
|
||||||
|
|
||||||
VBOX_UTF8_FREE(hddlocation);
|
VBOX_UTF8_FREE(hddlocation);
|
||||||
@ -7507,7 +7507,7 @@ static int vboxConnectListNetworks(virConnectPtr conn, char **const names, int n
|
|||||||
VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8);
|
VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8);
|
||||||
|
|
||||||
VIR_DEBUG("nnames[%d]: %s", ret, nameUtf8);
|
VIR_DEBUG("nnames[%d]: %s", ret, nameUtf8);
|
||||||
if (VIR_STRDUP(names[ret], nameUtf8) == 0)
|
if (VIR_STRDUP(names[ret], nameUtf8) >= 0)
|
||||||
ret++;
|
ret++;
|
||||||
|
|
||||||
VBOX_UTF8_FREE(nameUtf8);
|
VBOX_UTF8_FREE(nameUtf8);
|
||||||
@ -7585,7 +7585,7 @@ static int vboxConnectListDefinedNetworks(virConnectPtr conn, char **const names
|
|||||||
VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8);
|
VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8);
|
||||||
|
|
||||||
VIR_DEBUG("nnames[%d]: %s", ret, nameUtf8);
|
VIR_DEBUG("nnames[%d]: %s", ret, nameUtf8);
|
||||||
if (VIR_STRDUP(names[ret], nameUtf8) == 0)
|
if (VIR_STRDUP(names[ret], nameUtf8) >= 0)
|
||||||
ret++;
|
ret++;
|
||||||
|
|
||||||
VBOX_UTF8_FREE(nameUtf8);
|
VBOX_UTF8_FREE(nameUtf8);
|
||||||
@ -8087,7 +8087,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network,
|
|||||||
networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType);
|
networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType);
|
||||||
|
|
||||||
if (interfaceType == HostNetworkInterfaceType_HostOnly) {
|
if (interfaceType == HostNetworkInterfaceType_HostOnly) {
|
||||||
if (VIR_STRDUP(def->name, network->name) == 0) {
|
if (VIR_STRDUP(def->name, network->name) >= 0) {
|
||||||
PRUnichar *networkNameUtf16 = NULL;
|
PRUnichar *networkNameUtf16 = NULL;
|
||||||
IDHCPServer *dhcpServer = NULL;
|
IDHCPServer *dhcpServer = NULL;
|
||||||
vboxIID vboxnet0IID = VBOX_IID_INITIALIZER;
|
vboxIID vboxnet0IID = VBOX_IID_INITIALIZER;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user