From c14bc6ea4c85d823d39d6b49972e0acc493652b0 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Thu, 7 Sep 2023 13:59:33 +0200 Subject: [PATCH] Common/MemArena: mmap returns MAP_FAILED on error, not nullptr. --- Source/Core/Common/MemArenaAndroid.cpp | 2 +- Source/Core/Common/MemArenaUnix.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/MemArenaAndroid.cpp b/Source/Core/Common/MemArenaAndroid.cpp index 45b685274b..3c4b800da8 100644 --- a/Source/Core/Common/MemArenaAndroid.cpp +++ b/Source/Core/Common/MemArenaAndroid.cpp @@ -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; diff --git a/Source/Core/Common/MemArenaUnix.cpp b/Source/Core/Common/MemArenaUnix.cpp index f962da755a..ef359de908 100644 --- a/Source/Core/Common/MemArenaUnix.cpp +++ b/Source/Core/Common/MemArenaUnix.cpp @@ -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;