yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #52 from lioncash/memory

Common: Correctly set ptr to null if mmap fails in memory_util
This commit is contained in:
bunnei 2014-08-17 20:38:28 -04:00
commit 68c81f28d9
1 changed files with 9 additions and 6 deletions

View File

@ -51,13 +51,13 @@ void* AllocateExecutableMemory(size_t size, bool low)
// printf("Mapped executable memory at %p (size %ld)\n", ptr,
// (unsigned long)size);
#if defined(__FreeBSD__)
#ifdef _WIN32
if (ptr == nullptr)
{
#else
if (ptr == MAP_FAILED)
{
ptr = NULL;
#else
if (ptr == NULL)
{
ptr = nullptr;
#endif
PanicAlert("Failed to allocate executable memory");
}
@ -88,6 +88,9 @@ void* AllocateMemoryPages(size_t size)
#else
void* ptr = mmap(0, size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (ptr == MAP_FAILED)
ptr = nullptr;
#endif
// printf("Mapped memory at %p (size %ld)\n", ptr,