mirror of https://gitee.com/openkylin/libvirt.git
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>
This commit is contained in:
parent
5df67cdcd3
commit
d166cf76b0
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue