Skip to content

added guard to prevent dealloc and realloc on null ptr#8

Merged
ralph-lange merged 1 commit intomicro-ROS:dashingfrom
alsaibie:dashing
Jun 30, 2020
Merged

added guard to prevent dealloc and realloc on null ptr#8
ralph-lange merged 1 commit intomicro-ROS:dashingfrom
alsaibie:dashing

Conversation

@alsaibie
Copy link
Copy Markdown
Contributor

A small fix to memory management. Based on this issue.

usedMemory += size;
usedMemory -= getBlockSize(pointer);
return pvPortRealloc(pointer,size);
if (NULL != pointer){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For readability, I propose to swap the two cases, in order to avoid an else-branch for a unequal comparison.

@ralph-lange
Copy link
Copy Markdown
Contributor

Thank you very much for the contribution, @alsaibie.

@ralph-lange ralph-lange merged commit 60b5950 into micro-ROS:dashing Jun 30, 2020
fofolevrai pushed a commit to fofolevrai/freertos_apps that referenced this pull request Jun 14, 2021
Source for before building to fix agent build
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

Successfully merging this pull request may close these issues.

2 participants