[libvirt] [PATCH] Properly free the xmlDocPtr when loading pool state

Ján Tomko jtomko at redhat.com
Fri May 29 13:11:35 UTC 2015

Use xmlFreeDoc instead of plain xmlFree.

4 bytes in 1 blocks are definitely lost in loss record 9 of 1,084
    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x70730D6: xmlStrndup (in /usr/lib64/libxml2.so.2.9.2)
    by 0x701E3DC: xmlNewDoc (in /usr/lib64/libxml2.so.2.9.2)
    by 0x70C39F8: xmlSAX2StartDocument (in /usr/lib64/libxml2.so.2.9.2)
    by 0x7017245: xmlParseDocument (in /usr/lib64/libxml2.so.2.9.2)
    by 0x7017606: xmlDoRead (in /usr/lib64/libxml2.so.2.9.2)
    by 0x5309DAD: virXMLParseHelper (virxml.c:742)
    by 0x5367584: virStoragePoolLoadState (storage_conf.c:1863)
 src/conf/storage_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7857a5e..df536d4 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1894,7 +1894,7 @@ virStoragePoolLoadState(virStoragePoolObjListPtr pools,
-    xmlFree(xml);
+    xmlFreeDoc(xml);
     return pool;

More information about the libvir-list mailing list