fixed get_heap_size function by adding null pointer checks.
This commit is contained in:
parent
0e2633db9d
commit
7ebc328b5a
3
main.c
3
main.c
@ -157,6 +157,9 @@ void free(void* ptr)
|
|||||||
/// @returns Usage in bytes.
|
/// @returns Usage in bytes.
|
||||||
size_t get_heap_size()
|
size_t get_heap_size()
|
||||||
{
|
{
|
||||||
|
if (!first || !last)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return ((char*)last + last->size) - (char*)first;
|
return ((char*)last + last->size) - (char*)first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user