From: Nehal J Wani Date: Tue, 18 Mar 2014 07:32:24 +0000 (+0530) Subject: Fix memory leak in virDomainChrSourceDefClear() X-Git-Tag: v1.2.3-rc1~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24b3fcf98b73a99884eb4d26c839b9fad783f23c;p=thirdparty%2Flibvirt.git Fix memory leak in virDomainChrSourceDefClear() While running qemuxml2xmltest, it was found that valgrind pointed out the following memory leak: ==21905== 26 bytes in 1 blocks are definitely lost in loss record 23 of 69 ==21905== at 0x4A069EE: malloc (vg_replace_malloc.c:270) ==21905== by 0x3E782A754D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6) ==21905== by 0x4CD986D: virDomainChrSourceDefParseXML (domain_conf.c:7233) ==21905== by 0x4CE4199: virDomainChrDefParseXML (domain_conf.c:7512) ==21905== by 0x4CFAF3F: virDomainDefParseXML (domain_conf.c:12303) ==21905== by 0x4CFB46E: virDomainDefParseNode (domain_conf.c:13031) ==21905== by 0x4CFB5E9: virDomainDefParse (domain_conf.c:12973) ==21905== by 0x41E9D8: testCompareXMLToXMLFiles (qemuxml2xmltest.c:40) ==21905== by 0x41EBAA: testCompareXMLToXMLHelper (qemuxml2xmltest.c:93) ==21905== by 0x421D21: virtTestRun (testutils.c:199) ==21905== by 0x41FCE9: mymain.part.0 (qemuxml2xmltest.c:244) ==21905== by 0x42249D: virtTestMain (testutils.c:782) ==21905== ... and 7 more --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 92b1324007..f633db723d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1495,6 +1495,10 @@ virDomainChrSourceDefClear(virDomainChrSourceDefPtr def) case VIR_DOMAIN_CHR_TYPE_UNIX: VIR_FREE(def->data.nix.path); break; + + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: + VIR_FREE(def->data.spiceport.channel); + break; } }