summaryrefslogtreecommitdiff
path: root/Source/Core/Common/MemoryUtil.cpp
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2014-07-31 00:47:44 -0500
committerRyan Houdek <Sonicadvance1@gmail.com>2014-07-31 00:53:00 -0500
commit33450c80c3ca39ef1875f9c72898ba5749d06142 (patch)
tree16b816754213cfdce798d038616578cdaa7f18ff /Source/Core/Common/MemoryUtil.cpp
parentf5078273990e381a8437e945828444cefc410417 (diff)
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)
Diffstat (limited to 'Source/Core/Common/MemoryUtil.cpp')
-rw-r--r--Source/Core/Common/MemoryUtil.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/Core/Common/MemoryUtil.cpp b/Source/Core/Common/MemoryUtil.cpp
index 0ae08ced89..3a10d031cf 100644
--- a/Source/Core/Common/MemoryUtil.cpp
+++ b/Source/Core/Common/MemoryUtil.cpp
@@ -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__)
- if (ptr == MAP_FAILED)
+#ifdef _WIN32
+ if (ptr == nullptr)
{
- ptr = nullptr;
#else
- if (ptr == nullptr)
+ if (ptr == MAP_FAILED)
{
+ ptr = nullptr;
#endif
PanicAlert("Failed to allocate executable memory");
}