Received: from eggs.gnu.org ([2001:4830:134:3::10]:41143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMadv-0006kU-8M for qemu-devel@nongnu.org; Thu, 19 Sep 2013 05:35:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMadl-0002Zq-9r for qemu-devel@nongnu.org; Thu, 19 Sep 2013 05:35:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMadl-0002Zd-1s for qemu-devel@nongnu.org; Thu, 19 Sep 2013 05:35:13 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8J9ZCVb008218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Sep 2013 05:35:12 -0400 From: Gerd Hoffmann Date: Thu, 19 Sep 2013 11:34:56 +0200 Message-Id: <1379583298-7524-6-git-send-email-kraxel@redhat.com> In-Reply-To: <1379583298-7524-1-git-send-email-kraxel@redhat.com> References: <1379583298-7524-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 5/7] xhci: Fix memory leak on xhci_disable_ep List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Hans de Goede , Gerd Hoffmann From: Hans de Goede The USBPacket-s in the transfers need to be cleaned up so that the memory allocated by the iovec in there gets freed. Signed-off-by: Hans de Goede Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index eddfd50..469c24d 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -1380,6 +1380,7 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, { XHCISlot *slot; XHCIEPContext *epctx; + int i; trace_usb_xhci_ep_disable(slotid, epid); assert(slotid >= 1 && slotid <= xhci->numslots); @@ -1400,6 +1401,10 @@ static TRBCCode xhci_disable_ep(XHCIState *xhci, unsigned int slotid, xhci_free_streams(epctx); } + for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) { + usb_packet_cleanup(&epctx->transfers[i].packet); + } + xhci_set_ep_state(xhci, epctx, NULL, EP_DISABLED); timer_free(epctx->kick_timer); -- 1.8.3.1