[libvirt] [PATCH 1/3] virDomainDefParseXML: Free @tmp when parsing genid

Michal Privoznik mprivozn at redhat.com
Wed May 30 16:04:27 UTC 2018


We need to free return value of virXPathString().

==12962== 37 bytes in 1 blocks are definitely lost in loss record 156 of 331
==12962==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
==12962==    by 0x91E8439: strdup (in /lib64/libc-2.25.so)
==12962==    by 0x5DBD551: virStrdup (virstring.c:977)
==12962==    by 0x5DD3E5E: virXPathString (virxml.c:84)
==12962==    by 0x5E178AB: virDomainDefParseXML (domain_conf.c:19110)
==12962==    by 0x5E1E985: virDomainDefParseNode (domain_conf.c:20885)
==12962==    by 0x5E1E7CB: virDomainDefParse (domain_conf.c:20827)
==12962==    by 0x5E1E871: virDomainDefParseFile (domain_conf.c:20853)

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 27e2bd50eb..d8b4fbd6b0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19120,6 +19120,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                                "%s", _("malformed genid element"));
                 goto error;
             }
+            VIR_FREE(tmp);
         }
     }
     VIR_FREE(nodes);
-- 
2.16.1




More information about the libvir-list mailing list