Skip to contentSkip to conversation

usb: ehci: fix memory leak in ehci_init_transfer

PATCH New Li Qiang 1 participant 1 message Nov 8, 2016

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 usb: ehci: fix memory leak in ehci_init_transfer

From: Li Qiang <[email protected]>

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.

---
 hw/usb/hcd-ehci.c | 1 +
 1 file changed, 1 insertion(+)
hw/usb/hcd-ehci.c +1 -0
index f4ece9a..7622a3a 100644
@@ -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;
         }
 
Signature · 1 line
1.8.3.1