utility: Don't crash on nullptr in free_aligned

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-07-27 02:17:34 +02:00 committed by Michael Fabian Dirks
parent 69b925a3c8
commit b2dd816ff2

View file

@ -224,6 +224,8 @@ void util::free_aligned(void* mem)
#elif defined(USE_STD_ALLOC_FREE)
free(mem);
#else
if (mem == nullptr)
return;
void* ptr = reinterpret_cast<void*>(*reinterpret_cast<intptr_t*>(static_cast<char*>(mem) - sizeof(void*)));
free(ptr);
#endif