]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: Plug memory on virDomainDiskDefParseXML
authorAlex Jia <ajia@redhat.com>
Fri, 3 Feb 2012 08:42:22 +0000 (16:42 +0800)
committerOsier Yang <jyang@redhat.com>
Fri, 3 Feb 2012 08:57:15 +0000 (16:57 +0800)
commitd166cf76b0dbdf949e9594d8acfe0e62668c0268
treef2403716625303553a7ebfadae981abed54f6e8f
parent5df67cdcd37f18094526b9cf66252dfa8fc88b2c
conf: Plug memory on virDomainDiskDefParseXML

Detected by valgrind. Leak is introduced in commit 397e6a7.

* src/conf/domain_conf.c(virDomainDiskDefParseXML): fix memory leak.

How to reproduce?
% make -C tests check TESTS=qemuxml2argvtest
% cd tests && valgrind -v --leak-check=full ./qemuxml2argvtest

* Actual result:

==16352== 4 bytes in 1 blocks are definitely lost in loss record 12 of 147
==16352==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==16352==    by 0x39D90A67DD: xmlStrndup (xmlstring.c:45)
==16352==    by 0x4E83D5: virDomainDiskDefParseXML (domain_conf.c:2894)
==16352==    by 0x4F542D: virDomainDefParseXML (domain_conf.c:7626)
==16352==    by 0x4F8683: virDomainDefParseNode (domain_conf.c:8390)
==16352==    by 0x4F904E: virDomainDefParse (domain_conf.c:8340)
==16352==    by 0x41C626: testCompareXMLToArgvHelper (qemuxml2argvtest.c:105)
==16352==    by 0x41DED1: virtTestRun (testutils.c:142)
==16352==    by 0x418172: mymain (qemuxml2argvtest.c:486)
==16352==    by 0x41D5C7: virtTestMain (testutils.c:697)
==16352==    by 0x39CF01ECDC: (below main) (in /lib64/libc-2.12.so)

Signed-off-by: Alex Jia <ajia@redhat.com>
src/conf/domain_conf.c