Skip to content

Conversation

@aronlt
Copy link

@aronlt aronlt commented Jan 24, 2016

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.

@cryptomilk
Copy link

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.

Copy link
Contributor

@stewartmiles stewartmiles left a comment

Choose a reason for hiding this comment

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

Sorry about the slow response on this.

return ptr;
}

//Chech if the address is really allocated
Copy link
Contributor

Choose a reason for hiding this comment

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

Chech --> Check

const ListNode * const head = get_allocated_blocks_list();
const ListNode *node = head->next;
int rc = 0;
while(node != head){
Copy link
Contributor

Choose a reason for hiding this comment

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

We roughly follow google C++ style https://google.github.io/styleguide/cppguide.html in here.

So this should have some whitespace...

"while (node != head) {"

Copy link
Contributor

Choose a reason for hiding this comment

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

Same sort of this below with the "if" statements

#include <sys/types.h>

#if UNIT_TESTING
//#if UNIT_TESTING
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to keep this in place so that the wrapper for the allocator is only in place when testing.

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.

3 participants