mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
usb: dwc3: core: fix memory leaks in event buffer cleanup
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@oss.qualcomm.com> Reviewed-by: Marek Vasut <marek.vasut+usb@mailbox.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
This commit is contained in:
committed by
Marek Vasut
parent
70fd0c3bb7
commit
884b10e86a
@@ -206,6 +206,7 @@ static void dwc3_free_one_event_buffer(struct dwc3 *dwc,
|
||||
struct dwc3_event_buffer *evt)
|
||||
{
|
||||
dma_free_coherent(evt->buf);
|
||||
free(evt);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,6 +253,8 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)
|
||||
if (evt)
|
||||
dwc3_free_one_event_buffer(dwc, evt);
|
||||
}
|
||||
|
||||
free(dwc->ev_buffs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user