提交 e6ab1009 编写于 作者: M Michal Privoznik

Adapt to VIR_STRDUP and VIR_STRNDUP in src/vmware/*

上级 4a22990d
...@@ -174,11 +174,8 @@ vmwareLoadDomains(struct vmware_driver *driver) ...@@ -174,11 +174,8 @@ vmwareLoadDomains(struct vmware_driver *driver)
pDomain = vm->privateData; pDomain = vm->privateData;
pDomain->vmxPath = strdup(vmxPath); if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0)
if (pDomain->vmxPath == NULL) {
virReportOOMError();
goto cleanup; goto cleanup;
}
vmwareDomainConfigDisplay(pDomain, vmdef); vmwareDomainConfigDisplay(pDomain, vmdef);
...@@ -297,22 +294,21 @@ vmwareParsePath(char *path, char **directory, char **filename) ...@@ -297,22 +294,21 @@ vmwareParsePath(char *path, char **directory, char **filename)
return -1; return -1;
} }
if ((*directory = strdup(path)) == NULL) if (VIR_STRDUP(*directory, path) < 0)
goto no_memory; goto error;
if ((*filename = strdup(separator)) == NULL) { if (VIR_STRDUP(*filename, separator) < 0) {
VIR_FREE(*directory); VIR_FREE(*directory);
goto no_memory; goto error;
} }
} else { } else {
if ((*filename = strdup(path)) == NULL) if (VIR_STRDUP(*filename, path) < 0)
goto no_memory; goto error;
} }
return 0; return 0;
no_memory: error:
virReportOOMError();
return -1; return -1;
} }
...@@ -492,12 +488,8 @@ cleanup: ...@@ -492,12 +488,8 @@ cleanup:
char * char *
vmwareCopyVMXFileName(const char *datastorePath, void *opaque ATTRIBUTE_UNUSED) vmwareCopyVMXFileName(const char *datastorePath, void *opaque ATTRIBUTE_UNUSED)
{ {
char *path = strdup(datastorePath); char *path;
if (path == NULL) {
virReportOOMError();
return NULL;
}
ignore_value(VIR_STRDUP_QUIET(path, datastorePath));
return path; return path;
} }
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "vmx.h" #include "vmx.h"
#include "vmware_conf.h" #include "vmware_conf.h"
#include "vmware_driver.h" #include "vmware_driver.h"
#include "virstring.h"
static const char *vmw_types[] = { "player", "ws" }; static const char *vmw_types[] = { "player", "ws" };
...@@ -352,10 +353,8 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml) ...@@ -352,10 +353,8 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
goto cleanup; goto cleanup;
pDomain = vm->privateData; pDomain = vm->privateData;
if ((pDomain->vmxPath = strdup(vmxPath)) == NULL) { if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0)
virReportOOMError();
goto cleanup; goto cleanup;
}
vmwareDomainConfigDisplay(pDomain, vmdef); vmwareDomainConfigDisplay(pDomain, vmdef);
...@@ -636,7 +635,8 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml, ...@@ -636,7 +635,8 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
goto cleanup; goto cleanup;
pDomain = vm->privateData; pDomain = vm->privateData;
pDomain->vmxPath = strdup(vmxPath); if (VIR_STRDUP(pDomain->vmxPath, vmxPath) < 0)
goto cleanup;
vmwareDomainConfigDisplay(pDomain, vmdef); vmwareDomainConfigDisplay(pDomain, vmdef);
vmdef = NULL; vmdef = NULL;
...@@ -800,8 +800,7 @@ vmwareDomainGetOSType(virDomainPtr dom) ...@@ -800,8 +800,7 @@ vmwareDomainGetOSType(virDomainPtr dom)
goto cleanup; goto cleanup;
} }
if (!(ret = strdup(vm->def->os.type))) ignore_value(VIR_STRDUP(ret, vm->def->os.type));
virReportOOMError();
cleanup: cleanup:
if (vm) if (vm)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册