From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48748 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PUn2x-0000CF-2E for qemu-devel@nongnu.org; Mon, 20 Dec 2010 16:13:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PUn2t-0004ne-IF for qemu-devel@nongnu.org; Mon, 20 Dec 2010 16:13:31 -0500 Received: from cantor2.suse.de ([195.135.220.15]:43153 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PUn2t-0004n5-3y for qemu-devel@nongnu.org; Mon, 20 Dec 2010 16:13:27 -0500 From: Alexander Graf Date: Mon, 20 Dec 2010 22:13:23 +0100 Message-Id: <1292879604-22268-8-git-send-email-agraf@suse.de> In-Reply-To: <1292879604-22268-1-git-send-email-agraf@suse.de> References: <1292879604-22268-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 7/8] ahci: free dynamically allocated iovs List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Developers Cc: Kevin Wolf , Joerg Roedel , Gerd Hoffmann , Sebastian Herbszt We allocate iovs on the fly now, but also need to free them on uninit. This patch does that. Signed-off-by: Alexander Graf --- 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