+ // make sure the ptr we are 'bout to free makes sense
+ // the size trick comes from:
+ // https://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/malloc.c;h=1a1ac1d8f05b6f9bf295d7fdd0f12c2e4650a33c;hb=HEAD#l4437
+ assert_msg(((uintptr_t)ptr < (uintptr_t)(-sz)) && !((uintptr_t)ptr & ~0x3),
+ "free(): invalid pointer");
+ assert_msg(sz > WSIZE && (sz & ~0x3),
+ "free(): invalid size");
+