
On 2012年02月03日 16:42, ajia@redhat.com wrote:
From: Alex Jia<ajia@redhat.com>
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 | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index aeef9db..26e24f0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3413,6 +3413,7 @@ cleanup: VIR_FREE(bus); VIR_FREE(type); VIR_FREE(snapshot); + VIR_FREE(rawio); VIR_FREE(target); VIR_FREE(source); while (nhosts> 0) {
Trivial. ACK and pushed. Osier