[PATCH v2] usb: dwc3: core: fix memory leaks in event buffer cleanup

Mattijs Korpershoek mkorpershoek at kernel.org
Fri Apr 17 10:14:05 CEST 2026


Hi Gurumoorthy,

Thank you for the patch.

On Thu, Apr 16, 2026 at 11:25, Gurumoorthy Santhakumar <gurumoorthy.santhakumar at oss.qualcomm.com> wrote:

> In dwc3_free_one_event_buffer(), only the DMA buffer (evt->buf) was
> being freed via dma_free_coherent(), but the evt structure itself was
> never explicitly freed, causing a memory leak.
>
> In dwc3_free_event_buffers(), the ev_buffs pointer array allocated
> with memalign() was never freed after iterating and releasing all
> individual event buffers, causing another memory leak.
>
> Fix both leaks by freeing the evt struct in
> dwc3_free_one_event_buffer() and freeing dwc->ev_buffs in
> dwc3_free_event_buffers() after all entries have been released.
>
> Signed-off-by: Gurumoorthy Santhakumar <gurumoorthy.santhakumar at oss.qualcomm.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek at kernel.org>



More information about the U-Boot mailing list