[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] ide: ahci: call cleanup function in ahci unit
From: |
Li Qiang |
Subject: |
[Qemu-devel] [PATCH 2/2] ide: ahci: call cleanup function in ahci unit |
Date: |
Wed, 8 Feb 2017 23:04:04 -0800 |
This can avoid memory leak when hotunplug the ahci device.
Signed-off-by: Li Qiang <address@hidden>
---
hw/ide/ahci.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 3c19bda..56f68a8 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1485,6 +1485,14 @@ void ahci_realize(AHCIState *s, DeviceState *qdev,
AddressSpace *as, int ports)
void ahci_uninit(AHCIState *s)
{
+ int i;
+
+ for (i = 0; i < s->ports; i++) {
+ AHCIDevice *ad = &s->dev[i];
+
+ ide_unregister_restart_cb(&ad->port);
+ ide_exit(&ad->port);
+ }
g_free(s->dev);
}
--
1.8.3.1
Re: [Qemu-devel] [PATCH 1/2] ide: core: add cleanup function, John Snow, 2017/02/28
[Qemu-devel] [PATCH 2/2] ide: ahci: call cleanup function in ahci unit,
Li Qiang <=