Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

cell: Fix memory leak in case uAtClientUnlock returns failure #283

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

se-stefan
Copy link
Contributor

In the case uAtClientUnlock() in u_cell_http.c returned a failure code, the memory for pHttpInstance was not released.

The issue appeared rarely in combination with bad cellular coverage (disconnect during transmission attempt). The log files in indicated a memory leak:

01.01.00 01:42:39.956 DBG WDG [pool] malloc 72B @0x20001708   > pContext
01.01.00 01:42:39.956 DBG WDG [pool] malloc 80B @0x20001758   > pContext->semaphoreHandle
01.01.00 01:42:39.956 DBG WDG [pool] malloc 4B @0x20000cf8    > pContext->pPriv
01.01.00 01:42:39.957 DBG WDG [pool] malloc 1025B @0x20007b18 > pServerNameTemp
01.01.00 01:42:39.957 DBG WDG [pool] malloc 276B @0x20003af8  > pHttpInstance -> never released!
// uAtClientUnlock() returned -10 in u_cell_http.c
01.01.00 01:42:40.100 DBG WDG [pool] free @0x20007b18         < pServerNameTemp
01.01.00 01:42:40.100 DBG WDG [pool] free @0x20000cf8         < pContext->pPriv
01.01.00 01:42:40.100 DBG WDG [pool] free @0x20001758         < pContext->semaphoreHandle
01.01.00 01:42:40.101 DBG WDG [pool] free @0x20001708         < pContext

@RobMeades RobMeades self-requested a review October 3, 2024 07:20
Copy link
Contributor

@RobMeades RobMeades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very well spotted, thanks for this!

@RobMeades RobMeades merged commit 4d8e564 into u-blox:master Oct 3, 2024
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants