bugfix in ei_handmade_aligned_free for null pointers

This commit is contained in:
Gael Guennebaud 2009-01-12 12:54:32 +00:00
parent b365f443a2
commit a4252584ed

View File

@ -60,6 +60,7 @@ inline void* ei_handmade_aligned_malloc(size_t size)
/** \internal frees memory allocated with ei_handmade_aligned_malloc */ /** \internal frees memory allocated with ei_handmade_aligned_malloc */
inline void ei_handmade_aligned_free(void *ptr) inline void ei_handmade_aligned_free(void *ptr)
{ {
if(ptr)
free(*(reinterpret_cast<void**>(ptr) - 1)); free(*(reinterpret_cast<void**>(ptr) - 1));
} }