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

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to