[libvirt] [PATCH] Fix a qemuDomainPCIAddressSetFree memory leak

qemuDomainPCIAddressSetFree was freeing up the hash table for the pci addresses, but not freeing up the addr structure. Looking over the callers of this function, it seems like they expect it to also free up the structure, so do that here. Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index ed24916..5fa8c0a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -2110,7 +2110,7 @@ void qemuDomainPCIAddressSetFree(qemuDomainPCIAddressSetPtr addrs) return; virHashFree(addrs->used, qemuDomainPCIAddressSetFreeEntry); - addrs->used = NULL; + VIR_FREE(addrs); } -- 1.6.6.1

On 04/28/2010 02:27 PM, Chris Lalancette wrote:
qemuDomainPCIAddressSetFree was freeing up the hash table for the pci addresses, but not freeing up the addr structure. Looking over the callers of this function, it seems like they expect it to also free up the structure, so do that here.
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index ed24916..5fa8c0a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -2110,7 +2110,7 @@ void qemuDomainPCIAddressSetFree(qemuDomainPCIAddressSetPtr addrs) return;
virHashFree(addrs->used, qemuDomainPCIAddressSetFreeEntry); - addrs->used = NULL; + VIR_FREE(addrs);
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 04/28/2010 05:08 PM, Eric Blake wrote:
On 04/28/2010 02:27 PM, Chris Lalancette wrote:
qemuDomainPCIAddressSetFree was freeing up the hash table for the pci addresses, but not freeing up the addr structure. Looking over the callers of this function, it seems like they expect it to also free up the structure, so do that here.
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index ed24916..5fa8c0a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -2110,7 +2110,7 @@ void qemuDomainPCIAddressSetFree(qemuDomainPCIAddressSetPtr addrs) return;
virHashFree(addrs->used, qemuDomainPCIAddressSetFreeEntry); - addrs->used = NULL; + VIR_FREE(addrs);
ACK.
Thanks, pushed. -- Chris Lalancette
participants (2)
-
Chris Lalancette
-
Eric Blake