esx: Initialize all instances of esxVMX_Data to zero

To avoid using or freeing uninitialized memory or pointers.
This commit is contained in:
Matthias Bolte 2011-07-12 11:34:55 +02:00
parent b253452942
commit 38ea116eba

View File

@ -2698,10 +2698,11 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
char *vmx = NULL; char *vmx = NULL;
virVMXContext ctx; virVMXContext ctx;
esxVMX_Data data; esxVMX_Data data;
data.datastorePathWithoutFileName = NULL;
virDomainDefPtr def = NULL; virDomainDefPtr def = NULL;
char *xml = NULL; char *xml = NULL;
memset(&data, 0, sizeof (data));
if (esxVI_EnsureSession(priv->primary) < 0) { if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL; return NULL;
} }
@ -2805,6 +2806,8 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
virDomainDefPtr def = NULL; virDomainDefPtr def = NULL;
char *xml = NULL; char *xml = NULL;
memset(&data, 0, sizeof (data));
if (STRNEQ(nativeFormat, "vmware-vmx")) { if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
_("Unsupported config format '%s'"), nativeFormat); _("Unsupported config format '%s'"), nativeFormat);
@ -2844,6 +2847,8 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
virDomainDefPtr def = NULL; virDomainDefPtr def = NULL;
char *vmx = NULL; char *vmx = NULL;
memset(&data, 0, sizeof (data));
if (STRNEQ(nativeFormat, "vmware-vmx")) { if (STRNEQ(nativeFormat, "vmware-vmx")) {
ESX_ERROR(VIR_ERR_INVALID_ARG, ESX_ERROR(VIR_ERR_INVALID_ARG,
_("Unsupported config format '%s'"), nativeFormat); _("Unsupported config format '%s'"), nativeFormat);
@ -3066,6 +3071,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
char *taskInfoErrorMessage = NULL; char *taskInfoErrorMessage = NULL;
virDomainPtr domain = NULL; virDomainPtr domain = NULL;
memset(&data, 0, sizeof (data));
if (esxVI_EnsureSession(priv->primary) < 0) { if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL; return NULL;
} }