[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48268] trunk/blender/intern/guardedalloc/ MEM_guardedalloc.h: Guardedalloc/C++: delete is valid on a NULL pointer, add a check so MEM_freeN
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Jun 25 13:43:13 CEST 2012
Revision: 48268
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48268
Author: blendix
Date: 2012-06-25 11:43:12 +0000 (Mon, 25 Jun 2012)
Log Message:
-----------
Guardedalloc/C++: delete is valid on a NULL pointer, add a check so MEM_freeN
doesn't print warning messages.
Modified Paths:
--------------
trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
Modified: trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
===================================================================
--- trunk/blender/intern/guardedalloc/MEM_guardedalloc.h 2012-06-25 11:42:58 UTC (rev 48267)
+++ trunk/blender/intern/guardedalloc/MEM_guardedalloc.h 2012-06-25 11:43:12 UTC (rev 48268)
@@ -176,13 +176,15 @@
return MEM_mallocN(num_bytes, _id); \
} \
void operator delete(void *mem) { \
- MEM_freeN(mem); \
+ if (mem) \
+ MEM_freeN(mem); \
} \
void *operator new[](size_t num_bytes) { \
return MEM_mallocN(num_bytes, _id "[]"); \
} \
void operator delete[](void *mem) { \
- MEM_freeN(mem); \
+ if (mem) \
+ MEM_freeN(mem); \
} \
#endif
More information about the Bf-blender-cvs
mailing list