--- src/vmware/vmware_conf.c | 13 ++++++------- src/vmware/vmware_driver.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 4fb61a8..f7cd3bb 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -174,8 +174,7 @@ vmwareLoadDomains(struct vmware_driver *driver) pDomain = vm->privateData; - pDomain->vmxPath = strdup(vmxPath); - if (pDomain->vmxPath == NULL) { + if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0) { virReportOOMError(); goto cleanup; } @@ -297,15 +296,15 @@ vmwareParsePath(char *path, char **directory, char **filename) return -1; } - if ((*directory = strdup(path)) == NULL) + if (VIR_STRDUP(*directory, path) < 0) goto no_memory; - if ((*filename = strdup(separator)) == NULL) { + if (VIR_STRDUP(*filename, separator) < 0) { VIR_FREE(*directory); goto no_memory; } } else { - if ((*filename = strdup(path)) == NULL) + if (VIR_STRDUP(*filename, path) < 0) goto no_memory; } @@ -492,9 +491,9 @@ cleanup: char * vmwareCopyVMXFileName(const char *datastorePath, void *opaque ATTRIBUTE_UNUSED) { - char *path = strdup(datastorePath); + char *path; - if (path == NULL) { + if (VIR_STRDUP(path, datastorePath) < 0) { virReportOOMError(); return NULL; } diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 1e2634e..fc01321 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -33,6 +33,9 @@ #include "vmx.h" #include "vmware_conf.h" #include "vmware_driver.h" +#include "virstring.h" + +#define VIR_FROM_THIS VIR_FROM_VMWARE static const char *vmw_types[] = { "player", "ws" }; @@ -352,7 +355,7 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml) goto cleanup; pDomain = vm->privateData; - if ((pDomain->vmxPath = strdup(vmxPath)) == NULL) { + if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0) { virReportOOMError(); goto cleanup; } @@ -636,7 +639,10 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml, goto cleanup; pDomain = vm->privateData; - pDomain->vmxPath = strdup(vmxPath); + if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0) { + virReportOOMError(); + goto cleanup; + } vmwareDomainConfigDisplay(pDomain, vmdef); vmdef = NULL; @@ -800,7 +806,7 @@ vmwareDomainGetOSType(virDomainPtr dom) goto cleanup; } - if (!(ret = strdup(vm->def->os.type))) + if (VIR_STRDUP(ret, vm->def->os.type) < 0) virReportOOMError(); cleanup: -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list