diff options
-rw-r--r-- | standalone/combined.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/standalone/combined.h b/standalone/combined.h index 72e5caa026e..25ad11dbf7e 100644 --- a/standalone/combined.h +++ b/standalone/combined.h @@ -522,6 +522,9 @@ public: NOINLINE void deallocate(void *Ptr, Chunk::Origin Origin, uptr DeleteSize = 0, UNUSED uptr Alignment = MinAlignment) { + if (UNLIKELY(!Ptr)) + return; + // For a deallocation, we only ensure minimal initialization, meaning thread // local data will be left uninitialized for now (when using ELF TLS). The // fallback cache will be used instead. This is a workaround for a situation @@ -530,9 +533,6 @@ public: // being destroyed properly. Any other heap operation will do a full init. initThreadMaybe(/*MinimalInit=*/true); - if (UNLIKELY(!Ptr)) - return; - #ifdef GWP_ASAN_HOOKS if (UNLIKELY(GuardedAlloc.pointerIsMine(Ptr))) { GuardedAlloc.deallocate(Ptr); |