[libvirt] [PATCH] Fix memory leak in virDomainChrSourceDefClear()
Martin Kletzander
mkletzan at redhat.com
Tue Mar 18 09:07:57 UTC 2014
On Tue, Mar 18, 2014 at 01:02:24PM +0530, Nehal J Wani wrote:
> 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
>
> ---
> The leaks were specific to the tests:
> DO_TEST("serial-spiceport");
> DO_TEST("serial-spiceport-nospice");
>
Tanks for catching that. ACK and pushed now.
Martin
> src/conf/domain_conf.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 92b1324..f633db7 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;
> }
> }
>
> --
> 1.7.1
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140318/35ba3834/attachment-0001.sig>
More information about the libvir-list
mailing list