qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci: memory leak of PCIDevice::rom_file
@ 2011-01-24 10:00 Isaku Yamahata
  2011-01-24 13:39 ` [Qemu-devel] " Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Isaku Yamahata @ 2011-01-24 10:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: yamahata, mst

PCIDevice::rom_file is leaked.
PCIDevice::rom_file is allocated in pci_qdev_init(), but not freed anywhere.
free it in qemu_unregister_device().

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

diff --git a/hw/pci.c b/hw/pci.c
index b8f5385..044c4bd 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -833,6 +833,7 @@ static int pci_unregister_device(DeviceState *dev)
 
     pci_unregister_io_regions(pci_dev);
     pci_del_option_rom(pci_dev);
+    qemu_free(pci_dev->romfile);
     do_pci_unregister_device(pci_dev);
     return 0;
 }
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] pci: memory leak of PCIDevice::rom_file
  2011-01-24 10:00 [Qemu-devel] [PATCH] pci: memory leak of PCIDevice::rom_file Isaku Yamahata
@ 2011-01-24 13:39 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2011-01-24 13:39 UTC (permalink / raw)
  To: Isaku Yamahata; +Cc: qemu-devel

On Mon, Jan 24, 2011 at 07:00:47PM +0900, Isaku Yamahata wrote:
> PCIDevice::rom_file is leaked.
> PCIDevice::rom_file is allocated in pci_qdev_init(), but not freed anywhere.
> free it in qemu_unregister_device().
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>

Applied, thanks.

> ---
>  hw/pci.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index b8f5385..044c4bd 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -833,6 +833,7 @@ static int pci_unregister_device(DeviceState *dev)
>  
>      pci_unregister_io_regions(pci_dev);
>      pci_del_option_rom(pci_dev);
> +    qemu_free(pci_dev->romfile);
>      do_pci_unregister_device(pci_dev);
>      return 0;
>  }
> -- 
> 1.7.1.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-24 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-24 10:00 [Qemu-devel] [PATCH] pci: memory leak of PCIDevice::rom_file Isaku Yamahata
2011-01-24 13:39 ` [Qemu-devel] " Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).