From: mglocker Date: Sun, 18 Sep 2022 21:12:19 +0000 (+0000) Subject: Fix a memory leak which was introduced by the previous commit. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=54d482279aa5725182bc150d93d029a99b1ba116;p=openbsd Fix a memory leak which was introduced by the previous commit. The issue was reported by Stephan Somogyi - Thanks! --- diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c index cc19484cb1b..d1b65d4f264 100644 --- a/sys/dev/usb/dwc2/dwc2.c +++ b/sys/dev/usb/dwc2/dwc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2.c,v 1.67 2022/09/10 08:13:16 mglocker Exp $ */ +/* $OpenBSD: dwc2.c,v 1.68 2022/09/18 21:12:19 mglocker Exp $ */ /* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */ /*- @@ -242,7 +242,6 @@ dwc2_allocx(struct usbd_bus *bus) void dwc2_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) { - struct dwc2_xfer *dxfer = DWC2_XFER2DXFER(xfer); struct dwc2_softc *sc = DWC2_BUS2SC(bus); DPRINTFN(10, "\n"); @@ -255,7 +254,6 @@ dwc2_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) xfer->busy_free = XFER_FREE; #endif DWC2_EVCNT_INCR(sc->sc_ev_xferpoolput); - dwc2_hcd_urb_free(sc->sc_hsotg, dxfer->urb, xfer->nframes); pool_put(&sc->sc_xferpool, xfer); } diff --git a/sys/dev/usb/dwc2/dwc2_hcd.c b/sys/dev/usb/dwc2/dwc2_hcd.c index 57bb209fcfb..b3a54df9dd2 100644 --- a/sys/dev/usb/dwc2/dwc2_hcd.c +++ b/sys/dev/usb/dwc2/dwc2_hcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2_hcd.c,v 1.28 2022/09/09 21:16:54 mglocker Exp $ */ +/* $OpenBSD: dwc2_hcd.c,v 1.29 2022/09/18 21:12:19 mglocker Exp $ */ /* $NetBSD: dwc2_hcd.c,v 1.15 2014/11/24 10:14:14 skrll Exp $ */ /* @@ -4312,6 +4312,7 @@ void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, xfer); } + dwc2_hcd_urb_free(sc->sc_hsotg, dxfer->urb, xfer->nframes); qtd->urb = NULL; timeout_del(&xfer->timeout_handle); usb_rem_task(xfer->device, &xfer->abort_task);