Check for pointers

This commit is contained in:
Alex 2022-12-29 04:58:30 +02:00
parent 045592d8e6
commit cfb69bf15a
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -281,6 +281,12 @@ void *HeapCalloc(size_t n, size_t Size)
void *HeapRealloc(void *Address, size_t Size)
{
if (unlikely(!Address))
{
error("Attempt to realloc a null pointer");
return nullptr;
}
switch (AllocatorType)
{
case unlikely(MemoryAllocatorType::Pages):
@ -304,6 +310,12 @@ void *HeapRealloc(void *Address, size_t Size)
void HeapFree(void *Address)
{
if (unlikely(!Address))
{
warn("Attempt to free a null pointer");
return;
}
switch (AllocatorType)
{
case unlikely(MemoryAllocatorType::Pages):