diff --git a/src/mem/metaslab.h b/src/mem/metaslab.h index 0f959cb..6a87c89 100644 --- a/src/mem/metaslab.h +++ b/src/mem/metaslab.h @@ -109,11 +109,12 @@ namespace snmalloc /// simple corruptions. static SNMALLOC_FAST_PATH void store_next(void* p, void* head) { -#ifndef CHECK_CLIENT *static_cast(p) = head; -#else - *static_cast(p) = head; - *(static_cast(p) + 1) = address_cast(head) ^ POISON; +#if defined(CHECK_CLIENT) + if constexpr (aal_supports) + { + *(static_cast(p) + 1) = address_cast(head) ^ POISON; + } #endif } @@ -121,11 +122,14 @@ namespace snmalloc /// In Debug checks for simple corruptions. static SNMALLOC_FAST_PATH void* follow_next(void* node) { -#ifdef CHECK_CLIENT - uintptr_t next = *static_cast(node); - uintptr_t chk = *(static_cast(node) + 1); - if ((next ^ chk) != POISON) - error("Detected memory corruption. Use-after-free."); +#if defined(CHECK_CLIENT) + if constexpr (aal_supports) + { + uintptr_t next = *static_cast(node); + uintptr_t chk = *(static_cast(node) + 1); + if ((next ^ chk) != POISON) + error("Detected memory corruption. Use-after-free."); + } #endif return *static_cast(node); }