From c1abe07b0f17702005d6ad96ab6db2fa8082c9e3 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Mon, 27 Jul 2020 02:17:34 +0200 Subject: [PATCH] utility: Don't crash on nullptr in free_aligned --- source/utility.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/utility.cpp b/source/utility.cpp index 0ecf778d..80fec504 100644 --- a/source/utility.cpp +++ b/source/utility.cpp @@ -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(*reinterpret_cast(static_cast(mem) - sizeof(void*))); free(ptr); #endif