Made checks on client have own macro.

This commit is contained in:
Matthew Parkinson
2019-06-12 15:26:42 +01:00
parent 7153f2169c
commit cc6a9775d6
4 changed files with 13 additions and 7 deletions

View File

@@ -99,7 +99,7 @@ namespace snmalloc
/// simple corruptions.
static void store_next(void* p, uint16_t head)
{
#ifdef NDEBUG
#ifndef CHECK_CLIENT
*static_cast<size_t*>(p) = head;
#else
*static_cast<size_t*>(p) =
@@ -112,7 +112,7 @@ namespace snmalloc
static uint16_t follow_next(void* node)
{
size_t next = *static_cast<size_t*>(node);
#ifndef NDEBUG
#ifdef CHECK_CLIENT
if (((next ^ POISON) ^ (next << (bits::BITS - 16))) > 0xFFFF)
error("Detected memory corruption. Use-after-free.");
#endif