tests: Add additional check to allocator test

This commit is contained in:
Antonio Niño Díaz 2022-10-27 01:31:20 +01:00
parent b56c8dbf27
commit 1caee47b6f

View File

@ -304,11 +304,15 @@ int verify_consistency(NEChunk *list, void *start, void *end)
// The end of a chunk should be the start of the next one // The end of a chunk should be the start of the next one
if (list->end != list->next->start) if (list->end != list->next->start)
return -2; return -2;
// Two free chunks should never be together
if ((list->state == NE_STATE_FREE) && (list->next->state == NE_STATE_FREE))
return -3;
} }
// The last chunk should end at the end of the memory pool // The last chunk should end at the end of the memory pool
if (list->end != end) if (list->end != end)
return -3; return -4;
return 0; return 0;
} }