fixed get_heap_size function by adding null pointer checks.

This commit is contained in:
Arron David Nelson 2024-02-08 18:51:44 -08:00
parent 0e2633db9d
commit 7ebc328b5a

3
main.c
View File

@ -157,6 +157,9 @@ void free(void* ptr)
/// @returns Usage in bytes.
size_t get_heap_size()
{
if (!first || !last)
return 0;
return ((char*)last + last->size) - (char*)first;
}