mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-26 18:01:35 +01:00
unity_fixture: Make unity_free() NULL-safe
At the start of unity_free(), check mem for NULL, and return immediately if it is, so we don't crash in this case. This mimics the behaviour of most free() implementations. Closes #135. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
@@ -227,7 +227,14 @@ static void release_memory(void * mem)
|
||||
|
||||
void unity_free(void * mem)
|
||||
{
|
||||
int overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0;
|
||||
int overrun;
|
||||
|
||||
if (mem == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
overrun = isOverrun(mem);//strcmp(&memAsChar[guard->size], end) != 0;
|
||||
release_memory(mem);
|
||||
if (overrun)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user