From: Hans de Goede <hdegoede@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/5] xhci: Fix memory leak on xhci_disable_ep
Date: Tue, 17 Sep 2013 21:44:51 +0200 [thread overview]
Message-ID: <1379447093-20181-3-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1379447093-20181-1-git-send-email-hdegoede@redhat.com>
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 <hdegoede@redhat.com>
---
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 c209228..18d2e13 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1364,6 +1364,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);
@@ -1384,6 +1385,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);
qemu_free_timer(epctx->kick_timer);
--
1.8.3.1
next prev parent reply other threads:[~2013-09-17 19:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 19:44 [Qemu-devel] [PATCH 1/5] xhci: Init a transfers xhci, slotid and epid member on epctx alloc Hans de Goede
2013-09-17 19:44 ` [Qemu-devel] [PATCH 2/5] xhci: Add xhci_epid_to_usbep helper function Hans de Goede
2013-09-17 19:44 ` Hans de Goede [this message]
2013-09-17 19:44 ` [Qemu-devel] [PATCH 4/5] usb: Fix iovec memleak on combined-packet free Hans de Goede
2013-09-17 19:44 ` [Qemu-devel] [PATCH 5/5] usb: Also reset max_packet_size on ep_reset Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379447093-20181-3-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).