add: galloc: leak check

This commit is contained in:
starnakin 2023-07-23 15:35:16 +02:00
parent 7e0c7180d3
commit c6608ad4eb
2 changed files with 8 additions and 0 deletions

View File

@ -157,3 +157,8 @@ free(ptr)
last_block = next_block; last_block = next_block;
galloc_merge_blocks(first_block, last_block); galloc_merge_blocks(first_block, last_block);
} }
leaks()
{
return (heap + LOCATION_NEXT != NULL);
}

View File

@ -16,4 +16,7 @@ main()
ptr2 = galloc(0x9000); ptr2 = galloc(0x9000);
test_num(ptr2, 0, "alloc too big"); test_num(ptr2, 0, "alloc too big");
free(ptr2);
test_num(leaks(), 1, "leaks");
} }