311
311
unsigned char *ptr = (unsigned char *) p - MEM_DEBUG_HDR_SIZE;
312
312
MemoryDebugPtr debug_ptr = (MemoryDebugPtr) ptr;
313
313
size_t size = debug_ptr->size;
318
317
if (!ASSERT(((size_t) p & 1L) == 0))
321
320
if (debug_ptr->check == MEM_FREED) {
322
321
mm_println("MM ERROR: Pointer already freed 'debug_ptr->check != MEM_FREED'");
326
325
if (debug_ptr->check != MEM_HEADER) {
327
326
mm_println("MM ERROR: Header not valid 'debug_ptr->check != MEM_HEADER'");
331
330
if (!(*((unsigned char *) ptr + size + MEM_DEBUG_HDR_SIZE) == MEM_TRAILER_BYTE &&
332
331
*((unsigned char *) ptr + size + MEM_DEBUG_HDR_SIZE + 1L) == MEM_TRAILER_BYTE)) {
333
332
mm_throw_assertion(mm_ptr, p, "Trailer overwritten");