mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
Adapt to VIR_STRDUP and VIR_STRNDUP in src/vmware/*
This commit is contained in:
parent
4a22990dfd
commit
e6ab100980
@ -174,11 +174,8 @@ vmwareLoadDomains(struct vmware_driver *driver)
|
||||
|
||||
pDomain = vm->privateData;
|
||||
|
||||
pDomain->vmxPath = strdup(vmxPath);
|
||||
if (pDomain->vmxPath == NULL) {
|
||||
virReportOOMError();
|
||||
if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
vmwareDomainConfigDisplay(pDomain, vmdef);
|
||||
|
||||
@ -297,22 +294,21 @@ vmwareParsePath(char *path, char **directory, char **filename)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((*directory = strdup(path)) == NULL)
|
||||
goto no_memory;
|
||||
if ((*filename = strdup(separator)) == NULL) {
|
||||
if (VIR_STRDUP(*directory, path) < 0)
|
||||
goto error;
|
||||
if (VIR_STRDUP(*filename, separator) < 0) {
|
||||
VIR_FREE(*directory);
|
||||
goto no_memory;
|
||||
goto error;
|
||||
}
|
||||
|
||||
} else {
|
||||
if ((*filename = strdup(path)) == NULL)
|
||||
goto no_memory;
|
||||
if (VIR_STRDUP(*filename, path) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
no_memory:
|
||||
virReportOOMError();
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -492,12 +488,8 @@ cleanup:
|
||||
char *
|
||||
vmwareCopyVMXFileName(const char *datastorePath, void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char *path = strdup(datastorePath);
|
||||
|
||||
if (path == NULL) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
char *path;
|
||||
|
||||
ignore_value(VIR_STRDUP_QUIET(path, datastorePath));
|
||||
return path;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "vmx.h"
|
||||
#include "vmware_conf.h"
|
||||
#include "vmware_driver.h"
|
||||
#include "virstring.h"
|
||||
|
||||
static const char *vmw_types[] = { "player", "ws" };
|
||||
|
||||
@ -352,10 +353,8 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||
goto cleanup;
|
||||
|
||||
pDomain = vm->privateData;
|
||||
if ((pDomain->vmxPath = strdup(vmxPath)) == NULL) {
|
||||
virReportOOMError();
|
||||
if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
vmwareDomainConfigDisplay(pDomain, vmdef);
|
||||
|
||||
@ -636,7 +635,8 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
goto cleanup;
|
||||
|
||||
pDomain = vm->privateData;
|
||||
pDomain->vmxPath = strdup(vmxPath);
|
||||
if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0)
|
||||
goto cleanup;
|
||||
|
||||
vmwareDomainConfigDisplay(pDomain, vmdef);
|
||||
vmdef = NULL;
|
||||
@ -800,8 +800,7 @@ vmwareDomainGetOSType(virDomainPtr dom)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(ret = strdup(vm->def->os.type)))
|
||||
virReportOOMError();
|
||||
ignore_value(VIR_STRDUP(ret, vm->def->os.type));
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
|
Loading…
Reference in New Issue
Block a user