]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuxml2argvmock: Don't leak @netdef->ifname
authorMichal Privoznik <mprivozn@redhat.com>
Sat, 9 Jul 2016 06:57:46 +0000 (08:57 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 11 Jul 2016 14:25:08 +0000 (16:25 +0200)
commit1cbb8d4a5e246af18dc0b44e4faf4cb7f9e8cf19
tree88d41076f5578c0ef5decf8d23c328f4d3eaf763
parent958d6208a35c7eeef5ccb975b41e768c07e7e2ff
qemuxml2argvmock: Don't leak @netdef->ifname

In the mock, we have a stub for virNetDevTapCreate(). However,
the mocked version does not exactly as it's native counterpart.
The function receives a string, which is an interface name that
caller would like to have, but it's not guaranteed that they will
get just that one. If they don't, the function free()-s the one
passed and returns the new one. Just like the mocked version. But
what is the mocked version missing is the free().

==1068== 6 bytes in 1 blocks are definitely lost in loss record 9 of 132
==1068==    at 0x4C29F80: malloc (vg_replace_malloc.c:296)
==1068==    by 0xDE13356: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
==1068==    by 0xAE2333E: virXMLPropString (virxml.c:479)
==1068==    by 0xAE45975: virDomainNetDefParseXML (domain_conf.c:9038)
==1068==    by 0xAE5C0BB: virDomainDefParseXML (domain_conf.c:16734)
==1068==    by 0xAE5EB96: virDomainDefParseNode (domain_conf.c:17444)
==1068==    by 0xAE5EA05: virDomainDefParse (domain_conf.c:17391)
==1068==    by 0xAE5EA93: virDomainDefParseFile (domain_conf.c:17415)
==1068==    by 0x433430: testCompareXMLToArgvFiles (qemuxml2argvtest.c:278)
==1068==    by 0x433A18: testCompareXMLToArgvHelper (qemuxml2argvtest.c:414)
==1068==    by 0x446ED4: virTestRun (testutils.c:179)
==1068==    by 0x43A099: mymain (qemuxml2argvtest.c:1016)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tests/qemuxml2argvmock.c