diff mbox series

[1/2] hw: ehci: destroy sglist in error path

Message ID 20200812161712.29361-1-liq3ea@163.com (mailing list archive)
State New, archived
Headers show
Series [1/2] hw: ehci: destroy sglist in error path | expand

Commit Message

Li Qiang Aug. 12, 2020, 4:17 p.m. UTC
This may cause resource leak.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 hw/usb/hcd-ehci.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 1495e8f7fa..58cceacbf8 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1445,6 +1445,7 @@  static int ehci_process_itd(EHCIState *ehci,
             dev = ehci_find_device(ehci, devaddr);
             if (dev == NULL) {
                 ehci_trace_guest_bug(ehci, "no device found");
+                qemu_sglist_destroy(&ehci->isgl);
                 return -1;
             }
             pid = dir ? USB_TOKEN_IN : USB_TOKEN_OUT;