mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Common/MemArena: A zero-byte allocation is invalid.
This commit is contained in:
parent
c14bc6ea4c
commit
422bc7a627
@ -155,6 +155,9 @@ void* LazyMemoryRegion::Create(size_t size)
|
||||
{
|
||||
ASSERT(!m_memory);
|
||||
|
||||
if (size == 0)
|
||||
return nullptr;
|
||||
|
||||
void* memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
if (memory == MAP_FAILED)
|
||||
{
|
||||
|
@ -121,6 +121,9 @@ void* LazyMemoryRegion::Create(size_t size)
|
||||
{
|
||||
ASSERT(!m_memory);
|
||||
|
||||
if (size == 0)
|
||||
return nullptr;
|
||||
|
||||
void* memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
if (memory == MAP_FAILED)
|
||||
{
|
||||
|
@ -445,6 +445,9 @@ void* LazyMemoryRegion::Create(size_t size)
|
||||
{
|
||||
ASSERT(!m_memory);
|
||||
|
||||
if (size == 0)
|
||||
return nullptr;
|
||||
|
||||
void* memory = VirtualAlloc(nullptr, size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
if (!memory)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user