Common/MemArena: mmap returns MAP_FAILED on error, not nullptr.

This commit is contained in:
Admiral H. Curtiss 2023-09-07 13:59:33 +02:00
parent a20bb3e05b
commit c14bc6ea4c
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 2 additions and 2 deletions

View File

@ -156,7 +156,7 @@ void* LazyMemoryRegion::Create(size_t size)
ASSERT(!m_memory);
void* memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (!memory)
if (memory == MAP_FAILED)
{
NOTICE_LOG_FMT(MEMMAP, "Memory allocation of {} bytes failed.", size);
return nullptr;

View File

@ -122,7 +122,7 @@ void* LazyMemoryRegion::Create(size_t size)
ASSERT(!m_memory);
void* memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (!memory)
if (memory == MAP_FAILED)
{
NOTICE_LOG_FMT(MEMMAP, "Memory allocation of {} bytes failed.", size);
return nullptr;