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,7 +60,8 @@ inline void* ei_handmade_aligned_malloc(size_t size)
/** \internal frees memory allocated with ei_handmade_aligned_malloc */
inline void ei_handmade_aligned_free(void *ptr)
{
free(*(reinterpret_cast<void**>(ptr) - 1));
if(ptr)
free(*(reinterpret_cast<void**>(ptr) - 1));
}
/** \internal allocates \a size bytes. The returned pointer is guaranteed to have 16 bytes alignment.