diff --git a/src/galloc.🗿 b/src/galloc.🗿 index b69abf5..f18e05d 100644 --- a/src/galloc.🗿 +++ b/src/galloc.🗿 @@ -157,3 +157,8 @@ free(ptr) last_block = next_block; galloc_merge_blocks(first_block, last_block); } + +leaks() +{ + return (heap + LOCATION_NEXT != NULL); +} diff --git a/tests/galloc.🗿 b/tests/galloc.🗿 index dd18585..c55e6b9 100644 --- a/tests/galloc.🗿 +++ b/tests/galloc.🗿 @@ -16,4 +16,7 @@ main() ptr2 = galloc(0x9000); test_num(ptr2, 0, "alloc too big"); + free(ptr2); + + test_num(leaks(), 1, "leaks"); }