[PATCH v1] usb: dwc3: core: fix memory leaks in event buffer cleanup
Gurumoorthy Santhakumar
gurumoorthy.santhakumar at oss.qualcomm.com
Thu Apr 16 08:00:02 CEST 2026
Hi Marek,
Thanks for the feedback, please find my reply below,
On 4/14/2026 11:41 AM, Marek Vasut wrote:
> On 4/14/26 7:50 AM, Gurumoorthy Santhakumar wrote:
>
> [...]
>
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -206,6 +206,11 @@ static void dwc3_free_one_event_buffer(struct
>> dwc3 *dwc,
>> struct dwc3_event_buffer *evt)
>> {
>> dma_free_coherent(evt->buf);
>> +
>> + if (evt) {
>> + free(evt);
>
> It is valid to call free(NULL) , the if (...) conditional is not
> needed here.
I'll address this in V2 patch.
>
>> + evt = NULL;
>
> Is this assignment needed ?
> no, it is not needed
> I'll address the same in V2 patch.
> Thanks & Regrds,
> Guru
>> + }
>> }
>> /**
>> @@ -252,6 +257,11 @@ static void dwc3_free_event_buffers(struct dwc3
>> *dwc)
>> if (evt)
>> dwc3_free_one_event_buffer(dwc, evt);
>> }
>> +
>> + if (dwc->ev_buffs) {
>> + free(dwc->ev_buffs);
>> + dwc->ev_buffs = NULL;
>> + }
> Same two comments apply here.
More information about the U-Boot
mailing list