diff --git a/main.c b/main.c index dc86001..ccfe0b0 100644 --- a/main.c +++ b/main.c @@ -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; }