We allocate iovs on the fly now, but also need to free them on uninit.
This patch does that.

Signed-off-by: Alexander Graf <ag...@suse.de>
---
 hw/ide/ahci.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index c0bc5ff..97aef68 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1207,6 +1207,16 @@ void ahci_init(AHCIState *s, DeviceState *qdev, int 
ports)
 
 void ahci_uninit(AHCIState *s)
 {
+    int i, j;
+
+    for (i = 0; i < s->ports; i++) {
+        AHCIDevice *ad = &s->dev[i];
+        for (j = 0; j < AHCI_MAX_CMDS; j++) {
+            if (ad->ncq_tfs[j].iov_max) {
+                qemu_free(ad->ncq_tfs[j].iov);
+            }
+        }
+    }
     qemu_free(s->dev);
 }
 
-- 
1.6.0.2


Reply via email to