From: Matthias Bolte Date: Tue, 12 Jul 2011 09:34:55 +0000 (+0200) Subject: esx: Initialize all instances of esxVMX_Data to zero X-Git-Tag: v0.9.4-rc1~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38ea116eba7778f2894db264f96bbd70ed9e2994;p=thirdparty%2Flibvirt.git esx: Initialize all instances of esxVMX_Data to zero To avoid using or freeing uninitialized memory or pointers. --- diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index ae614a6b24..4643a3276a 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2698,10 +2698,11 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) char *vmx = NULL; virVMXContext ctx; esxVMX_Data data; - data.datastorePathWithoutFileName = NULL; virDomainDefPtr def = NULL; char *xml = NULL; + memset(&data, 0, sizeof (data)); + if (esxVI_EnsureSession(priv->primary) < 0) { return NULL; } @@ -2805,6 +2806,8 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat, virDomainDefPtr def = NULL; char *xml = NULL; + memset(&data, 0, sizeof (data)); + if (STRNEQ(nativeFormat, "vmware-vmx")) { ESX_ERROR(VIR_ERR_INVALID_ARG, _("Unsupported config format '%s'"), nativeFormat); @@ -2844,6 +2847,8 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat, virDomainDefPtr def = NULL; char *vmx = NULL; + memset(&data, 0, sizeof (data)); + if (STRNEQ(nativeFormat, "vmware-vmx")) { ESX_ERROR(VIR_ERR_INVALID_ARG, _("Unsupported config format '%s'"), nativeFormat); @@ -3066,6 +3071,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml) char *taskInfoErrorMessage = NULL; virDomainPtr domain = NULL; + memset(&data, 0, sizeof (data)); + if (esxVI_EnsureSession(priv->primary) < 0) { return NULL; }