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

Peter Krempa pkrempa at redhat.com
Fri May 29 13:15:12 UTC 2015


On Fri, May 29, 2015 at 15:11:35 +0200, Ján Tomko wrote:
> 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,
>  
>   cleanup:
>      VIR_FREE(stateFile);
> -    xmlFree(xml);
> +    xmlFreeDoc(xml);
>      xmlXPathFreeContext(ctxt);
>      return pool;

ACK, safe for freeze.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150529/c80cd843/attachment-0001.sig>


More information about the libvir-list mailing list