diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-06-25 15:43:12 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-06-25 15:43:12 +0400 |
commit | ae797383b76a4489139b0152a6084b5dd4de2ba3 (patch) | |
tree | 39e6132ca8c0d0ac604936880712cbe845bfc7b4 /intern/guardedalloc/MEM_guardedalloc.h | |
parent | 2b41b6d669fa6fc62b20785adba9fb60f000e63e (diff) |
Guardedalloc/C++: delete is valid on a NULL pointer, add a check so MEM_freeN
doesn't print warning messages.
Diffstat (limited to 'intern/guardedalloc/MEM_guardedalloc.h')
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index bb4c372e46d..1d0a8db6329 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -176,13 +176,15 @@ public: \ 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 |