Found by 'make -C tests valgrind'.
xen_xm.c: Dummy allocation via virDomainChrDefNew is directly
overwritten and lost. Free 'script' in success path too.
vmx.c: Free virtualDev_string in success path too.
domain_conf.c: Free compression in success path too.
---
src/conf/domain_conf.c | 1 +
src/vmx/vmx.c | 16 +++++++++-------
src/xenxs/xen_xm.c | 3 +--
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 381e692..0e7aeb5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4058,6 +4058,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
VIR_FREE(compression);
goto error;
}
+ VIR_FREE(compression);
def->data.spice.zlib = compressionVal;
} else if (xmlStrEqual(cur->name, BAD_CAST "playback")) {
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index daeedc3..aee2d80 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1818,6 +1818,7 @@ int
virVMXParseSCSIController(virConfPtr conf, int controller, bool *present,
int *virtualDev)
{
+ int result = -1;
char present_name[32];
char virtualDev_name[32];
char *virtualDev_string = NULL;
@@ -1840,16 +1841,17 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool
*present,
controller);
if (virVMXGetConfigBoolean(conf, present_name, present, false, true) < 0) {
- goto failure;
+ goto cleanup;
}
if (! *present) {
- return 0;
+ result = 0;
+ goto cleanup;
}
if (virVMXGetConfigString(conf, virtualDev_name, &virtualDev_string,
true) < 0) {
- goto failure;
+ goto cleanup;
}
if (virtualDev_string != NULL) {
@@ -1870,16 +1872,16 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool
*present,
_("Expecting VMX entry '%s' to be 'buslogic'
or 'lsilogic' "
"or 'lsisas1068' or 'pvscsi' but found
'%s'"),
virtualDev_name, virtualDev_string);
- goto failure;
+ goto cleanup;
}
}
- return 0;
+ result = 0;
- failure:
+ cleanup:
VIR_FREE(virtualDev_string);
- return -1;
+ return result;
}
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index dbcaf15..63ba153 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -983,8 +983,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
continue;
}
- if (!(chr = virDomainChrDefNew()))
- goto cleanup;
if (!(chr = xenParseSxprChar(port, NULL)))
goto cleanup;
@@ -1034,6 +1032,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto cleanup;
}
+ VIR_FREE(script);
return def;
no_memory:
--
1.7.0.4