summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-19 07:27:30 +0000
committerspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-19 07:27:30 +0000
commit2523818db5f2c77e38b7bf51944ed9fbe321700f (patch)
tree0874880904452a4803d2969ed224701602df46ef
parent6eeecaada5818d8dc1f3bb98c3e0916d195e3592 (diff)
Use correct behavior (as per C++) for 'delete NULL' on windows; found by Adam and CyberBotX
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11443 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--win/inspircd_memory_functions.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/win/inspircd_memory_functions.cpp b/win/inspircd_memory_functions.cpp
index 9dec63f67..4eeadfab1 100644
--- a/win/inspircd_memory_functions.cpp
+++ b/win/inspircd_memory_functions.cpp
@@ -40,7 +40,8 @@ void * ::operator new(size_t iSize)
void ::operator delete(void * ptr)
{
- HeapFree(GetProcessHeap(), 0, ptr);
+ if (ptr)
+ HeapFree(GetProcessHeap(), 0, ptr);
}
void * operator new[] (size_t iSize) {
@@ -53,5 +54,6 @@ void * operator new[] (size_t iSize) {
void operator delete[] (void* ptr)
{
- HeapFree(GetProcessHeap(), 0, ptr);
+ if (ptr)
+ HeapFree(GetProcessHeap(), 0, ptr);
}