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

Marek Vasut marek.vasut at mailbox.org
Thu Apr 16 11:06:03 CEST 2026


On 4/16/26 7:55 AM, Gurumoorthy Santhakumar 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: Marek Vasut <marek.vasut+usb at mailbox.org>

Thank you


More information about the U-Boot mailing list