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

Michal Privoznik posted 1 patch 5 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/45737a45080ea55783604331d464e69001908084.1526385105.git.mprivozn@redhat.com
Test syntax-check passed
src/conf/domain_conf.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] virDomainMemoryDefParseXML: Don't leak discard
Posted by Michal Privoznik 5 years, 11 months ago
==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@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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virDomainMemoryDefParseXML: Don't leak discard
Posted by Marc Hartmayer 5 years, 11 months ago
On Tue, May 15, 2018 at 01:51 PM +0200, Michal Privoznik <mprivozn@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@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@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>

Reviewed-by: Marc Hartmayer <mhartmay@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


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list