diff mbox

[7/8] ahci: free dynamically allocated iovs

Message ID 1292879604-22268-8-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf Dec. 20, 2010, 9:13 p.m. UTC
We allocate iovs on the fly now, but also need to free them on uninit.
This patch does that.

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

Comments

Kevin Wolf Jan. 18, 2011, 12:41 p.m. UTC | #1
Am 20.12.2010 22:13, schrieb Alexander Graf:
> We allocate iovs on the fly now, but also need to free them on uninit.
> This patch does that.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

Isn't this a fix for patch 4? If so, please merge it there.

Kevin
diff mbox

Patch

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);
 }