Patchwork [v2,1/3] pci: fix memory leak of PCIDevice::romfile.

login
register
mail settings
Submitter Isaku Yamahata
Date June 22, 2010, 2:55 a.m.
Message ID <194431c7d3de831a5084a63447401d2a0883d13c.1277174072.git.yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/56393/
State New
Headers show

Comments

Isaku Yamahata - June 22, 2010, 2:55 a.m.
PCIDevice::romfile is allocatedi n pci_qdev_init(). But nowhere freed.
Free it in do_pci_unregister_device().

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 7787005..7e5c539 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -650,6 +650,7 @@  static void do_pci_unregister_device(PCIDevice *pci_dev)
     qemu_free_irqs(pci_dev->irq);
     pci_dev->bus->devices[pci_dev->devfn] = NULL;
     pci_config_free(pci_dev);
+    qemu_free(pci_dev->romfile);
 }
 
 PCIDevice *pci_register_device(PCIBus *bus, const char *name,