This function calls virDomainDefAddImplicitDevices() which adds
implicit video device to domain definition. However, later in the
process the function just ignores this and overwrites the @videos
array without prior free.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/vmx/vmx.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 96507f10f..858bc090d 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1305,6 +1305,7 @@ virVMXParseConfig(virVMXContext *ctx,
long long sharedFolder_maxNum = 0;
int cpumasklen;
char *namespaceData;
+ size_t i;
if (ctx->parseFileName == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1761,11 +1762,13 @@ virVMXParseConfig(virVMXContext *ctx,
/* FIXME */
/* def:videos */
- if (VIR_ALLOC_N(def->videos, 1) < 0)
- goto cleanup;
-
+ for (i = 0; i < def->nvideos; i++)
+ virDomainVideoDefFree(def->videos[i]);
def->nvideos = 0;
+ if (VIR_REALLOC_N(def->videos, 1) < 0)
+ goto cleanup;
+
if (virVMXParseSVGA(conf, &def->videos[def->nvideos]) < 0)
goto cleanup;
--
2.13.0