qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Li Qiang <liqiang6-s@360.cn>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 1/2] usb: ehci: fix memory leak in ehci_init_transfer
Date: Wed,  9 Nov 2016 14:33:30 +0100	[thread overview]
Message-ID: <1478698412-4865-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1478698412-4865-1-git-send-email-kraxel@redhat.com>

From: Li Qiang <liqiang6-s@360.cn>

In ehci_init_transfer function, if the 'cpage' is bigger than 4,
it doesn't free the 'p->sgl' once allocated previously thus leading
a memory leak issue. This patch avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Message-id: 5821c0f4.091c6b0a.e0c92.e811@mx.google.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-ehci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index f4ece9a..7622a3a 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1190,6 +1190,7 @@ static int ehci_init_transfer(EHCIPacket *p)
     while (bytes > 0) {
         if (cpage > 4) {
             fprintf(stderr, "cpage out of range (%d)\n", cpage);
+            qemu_sglist_destroy(&p->sgl);
             return -1;
         }
 
-- 
1.8.3.1

  reply	other threads:[~2016-11-09 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 13:33 [Qemu-devel] [PULL for-2.8 0/2] usb: two memory leak fixes Gerd Hoffmann
2016-11-09 13:33 ` Gerd Hoffmann [this message]
2016-11-09 13:33 ` [Qemu-devel] [PULL 2/2] usbredir: free vm_change_state_handler in usbredir destroy dispatch Gerd Hoffmann
2016-11-10 10:55 ` [Qemu-devel] [PULL for-2.8 0/2] usb: two memory leak fixes Stefan Hajnoczi

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=1478698412-4865-2-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=liqiang6-s@360.cn \
    --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).