forked from bartvdbraak/blender
Guardedalloc/C++: delete is valid on a NULL pointer, add a check so MEM_freeN
doesn't print warning messages.
This commit is contained in:
parent
2b41b6d669
commit
ae797383b7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user