update memory allocate check#30
Open
aronlt wants to merge 1 commit intogoogle:masterfrom
aronlt:master
Open
Conversation
|
cmockery is dead since several years, you probably want to take a look at https://cmocka.org which is the successor of cmockery. We are happy to accept patches to improve it. |
Contributor
stewartmiles
left a comment
There was a problem hiding this comment.
Sorry about the slow response on this.
| return ptr; | ||
| } | ||
|
|
||
| //Chech if the address is really allocated |
| const ListNode * const head = get_allocated_blocks_list(); | ||
| const ListNode *node = head->next; | ||
| int rc = 0; | ||
| while(node != head){ |
Contributor
There was a problem hiding this comment.
We roughly follow google C++ style https://google.github.io/styleguide/cppguide.html in here.
So this should have some whitespace...
"while (node != head) {"
Contributor
There was a problem hiding this comment.
Same sort of this below with the "if" statements
| #include <sys/types.h> | ||
|
|
||
| #if UNIT_TESTING | ||
| //#if UNIT_TESTING |
Contributor
There was a problem hiding this comment.
We need to keep this in place so that the wrapper for the allocator is only in place when testing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If we pass an invalid pointer to _test_free() function, this function will be crashed. So I update this function, add some checking code. Therefore, cmockery can test cases that free invaild pointer, and free an allocated block twice.