summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Qiang2016-11-08 13:11:10 +0100
committerStefan Hajnoczi2016-11-10 16:29:58 +0100
commit791f97758e223de3290592d169f8e6339c281714 (patch)
tree0d1887dd38aebbfb4b3f300d83b09f0557767af1
parentipxe: update to 20161108 snapshot (diff)
downloadqemu-791f97758e223de3290592d169f8e6339c281714.tar.gz
qemu-791f97758e223de3290592d169f8e6339c281714.tar.xz
qemu-791f97758e223de3290592d169f8e6339c281714.zip
usb: ehci: fix memory leak in ehci_init_transfer
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>
-rw-r--r--hw/usb/hcd-ehci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index f4ece9abed..7622a3ae72 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;
}