Cellular Interface - Allocated Context Memory is Leaked if Cellular Init fails

Hello all,

I have been debugging some Cellular Init failures and noticed that no cleanup code is executed if Cellular Init fails.

I checked the common implementation and documentation to make sure if user is responsible for calling cleanup themselves but it is not explicitly laid out.

I wouldn’t have thought to call cleanup on failed init calls on a library as well. Not a common practice.

Is this behavior intended or an oversight?

Thank you,
Tuna

Hi @tbicim

Thank you for bringing this to our attention. I will reach out to the cellular team.

Best,

Jason Carroll

1 Like

@tbicim

In Cellular Init function, _Cellular_LibInit cleans up the resource allocated when there is error in the function.
Resource allocated by _Cellular_LibInit should also be cleaned up when module port functions return error, including Cellular_ModuleInit, Cellular_ModuleEnableUE and Cellular_ModuleEnableUE.

Thank you for pointing out this problem.
We will create a PR to fix this problem and update in this thread again.

@tbicim
The PR to address this problem is merged. Thank you again for reporting this problem.

3 Likes