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

Check memory allocation #51

Open
2 tasks
AntoineGautier opened this issue Mar 22, 2021 · 0 comments
Open
2 tasks

Check memory allocation #51

AntoineGautier opened this issue Mar 22, 2021 · 0 comments

Comments

@AntoineGautier
Copy link
Collaborator

AntoineGautier commented Mar 22, 2021

In algorithmRectangle.c the functions calculateLower and calculateUpper do not dynamically allocate memory to struct data lower and struct data upper.
It is neither done in compare.c which invokes those functions, see https://github.com/lbl-srg/funnel/blob/master/src/compare.c#L210-L212.
This will likely lead to stack overflow in case of large arrays.

EDIT: The memory allocation for the member arrays is done in removeLoop.

This issue must:

  • Check all memory allocations throughout the code: is it even done? Is it checked for success before assignment? Is it freed eventually? Is free always used to free memory actually allocated dynamically with malloc?
  • Check that potentially large data struct are passed systematically by reference rather than by values.
@AntoineGautier AntoineGautier changed the title Fix malloc missing Fix memory allocation Mar 22, 2021
@AntoineGautier AntoineGautier changed the title Fix memory allocation Check memory allocation Mar 22, 2021
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

1 participant