From: Laine Stump Date: Thu, 8 Mar 2012 06:46:36 +0000 (-0500) Subject: qemu: eliminate memory leak in qemuDomainUpdateDeviceConfig X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7a23ba090dd8a374974d3da0180ea3a6ffdc05fb;p=libvirt.git qemu: eliminate memory leak in qemuDomainUpdateDeviceConfig This function was freeing a virDomainNetDef with VIR_FREE(). virDomainNetDef is a complex structure with many pointers to other dynamically allocated data; to properly free it virDomainNetDefFree() must be called instead, otherwise several strings (and potentially other things) will be leaked. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a760b06ea0..be678f3652 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5570,7 +5570,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, return -1; } - VIR_FREE(vmdef->nets[pos]); + virDomainNetDefFree(vmdef->nets[pos]); vmdef->nets[pos] = net; dev->data.net = NULL;