Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leakage problem in atc.c file #3

Open
ogulcan90 opened this issue Oct 6, 2021 · 3 comments
Open

Memory leakage problem in atc.c file #3

ogulcan90 opened this issue Oct 6, 2021 · 3 comments

Comments

@ogulcan90
Copy link

Hi Nima,

In your atc.c file, atc_addSearch() function you are allocation memory as follows:

atc->search[atc->searchIndex] = (char*) atc_alloc(strlen(str) + 1);

However, you do not free the memory afterwards, thus, I believe this creates a memory leak, which leads a crush after some time. I'm using you gsm_v5 library that uses this library, so this problem affects it.

To solve this, I think you can put the following just before the "return true"
atc_free(atc->search[atc->searchIndex]);

Regards,
Ogulcan

@nimaltd
Copy link
Owner

nimaltd commented Oct 6, 2021

Hello please increase it in config file

@ogulcan90
Copy link
Author

It doesn't matter. An allocated memory has to be freed in order not to have a memory leakage. This is a rule.

Am I missing something?

@nimaltd
Copy link
Owner

nimaltd commented Oct 9, 2021

this function for always search in your program. like some at-commands for ring and get new message. you don't need to delete it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants