summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/malloc-standard/malloc.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h
index c281418d3..f196a560f 100644
--- a/libc/stdlib/malloc-standard/malloc.h
+++ b/libc/stdlib/malloc-standard/malloc.h
@@ -849,8 +849,11 @@ typedef struct malloc_chunk* mfastbinptr;
*/
#define PROTECT_PTR(pos, ptr) ((mchunkptr)((((size_t)pos) >> PAGE_SHIFT) ^ ((size_t)ptr)))
#define REVEAL_PTR(pos, ptr) PROTECT_PTR(pos, ptr)
-#define CHECK_PTR(P) \
- if (!aligned_OK(P)) \
+#define PTR_FOR_ALIGNMENT_CHECK(P) \
+ (MALLOC_ALIGNMENT == 2*(sizeof(size_t)) ? (P) : chunk2mem(P))
+
+#define CHECK_PTR(P) \
+ if (!aligned_OK(PTR_FOR_ALIGNMENT_CHECK(P))) \
abort();
/*