[libvirt] [PATCH] virDomainMemoryDefParseXML: Don't leak discard

Marc Hartmayer mhartmay at linux.ibm.com
Tue May 15 13:15:00 UTC 2018


On Tue, May 15, 2018 at 01:51 PM +0200, Michal Privoznik <mprivozn at redhat.com> wrote:
> ==1589== 7 bytes in 2 blocks are definitely lost in loss record 34 of 261
> ==1589==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
> ==1589==    by 0x8A82794: xmlStrndup (in /usr/lib64/libxml2.so.2.9.8)
> ==1589==    by 0x5DD8392: virXMLPropString (virxml.c:510)
> ==1589==    by 0x5E12427: virDomainMemoryDefParseXML (domain_conf.c:15704)
> ==1589==    by 0x5E207DE: virDomainDefParseXML (domain_conf.c:20351)
> ==1589==    by 0x5E2184F: virDomainDefParseNode (domain_conf.c:20636)
> ==1589==    by 0x5E216A1: virDomainDefParse (domain_conf.c:20580)
> ==1589==    by 0x5E21747: virDomainDefParseFile (domain_conf.c:20606)
> ==1589==    by 0x112F5F: testCompareXMLToArgv (qemuxml2argvtest.c:493)
> ==1589==    by 0x138780: virTestRun (testutils.c:180)
> ==1589==    by 0x117129: mymain (qemuxml2argvtest.c:937)
> ==1589==    by 0x13A83C: virTestMain (testutils.c:1120)
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/conf/domain_conf.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index d38a775f21..338fbc0e61 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -15710,6 +15710,7 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr xmlopt,
>
>          def->discard = val;
>      }
> +    VIR_FREE(tmp);
>
>      /* source */
>      if ((node = virXPathNode("./source", ctxt)) &&
> -- 
> 2.16.1
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>

Reviewed-by: Marc Hartmayer <mhartmay at linux.ibm.com>

-- 
Beste Grüße / Kind regards
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294





More information about the libvir-list mailing list