Fixes a check for what mmap returns.

On error mmap returns MAP_FAILED(-1) not null.
FreeBSD was checking the return correctly, Linux was not.
This was noticed by triad attempting to run Dolphin under valgrind and not getting a memory space under the 2GB limit(Because -1 wraps around on
unsigned obviously)
This commit is contained in:
Ryan Houdek 2014-07-31 00:47:44 -05:00
parent f507827399
commit 33450c80c3
1 changed files with 4 additions and 4 deletions

View File

@ -54,13 +54,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 = nullptr;
#else
if (ptr == nullptr)
{
#endif
PanicAlert("Failed to allocate executable memory");
}