On 08/04/2017 04:22 PM, Michal Privoznik wrote: > 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@xxxxxxxxxx> > --- > 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; > > Oh, forgot to push this into the commit: diff --git i/src/vmx/vmx.c w/src/vmx/vmx.c index 858bc090d..d111b1ef1 100644 --- i/src/vmx/vmx.c +++ w/src/vmx/vmx.c @@ -3035,7 +3035,7 @@ virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def) int result = -1; long long svga_vramSize = 0; - if (def == NULL || *def != NULL) { + if (def == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } Consider it squashed in locally. Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list