diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/inspircd_memory_functions.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/win/inspircd_memory_functions.cpp b/win/inspircd_memory_functions.cpp index d03330bf5..7e2f23194 100644 --- a/win/inspircd_memory_functions.cpp +++ b/win/inspircd_memory_functions.cpp @@ -1,9 +1,16 @@ // Use the global heap for this process for all allocate/free operations.
#include "inspircd_win32wrapper.h"
+#include <exception.h>
void * ::operator new(size_t iSize)
{
- return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, iSize); // zero memory for unix compatibility
+ void* ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, iSize); // zero memory for unix compatibility
+ /* This is the correct behaviour according to C++ standards for out of memory,
+ * not returning null -- Brain*/
+ if (!ptr)
+ throw std::bad_alloc;
+ else
+ return ptr;
}
void ::operator delete(void * ptr)
|