From 198946231c389acaea10bf047f70264a27617b02 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Mon, 8 Jul 2019 11:36:52 +0200 Subject: imported MOpt and worked around the collisions with other patches --- alloc-inl.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'alloc-inl.h') diff --git a/alloc-inl.h b/alloc-inl.h index d3c125fb..04f56d0d 100644 --- a/alloc-inl.h +++ b/alloc-inl.h @@ -76,6 +76,17 @@ /* Sanity-checking macros for pointers. */ +#define CHECK_PTR(_p) do { \ + if (_p) { \ + if (ALLOC_C1(_p) ^ ALLOC_MAGIC_C1) {\ + if (ALLOC_C1(_p) == ALLOC_MAGIC_F) \ + ABORT("Use after free."); \ + else ABORT("Corrupted head alloc canary."); \ + } \ + } \ + } while (0) + +/* #define CHECK_PTR(_p) do { \ if (_p) { \ if (ALLOC_C1(_p) ^ ALLOC_MAGIC_C1) {\ @@ -87,6 +98,7 @@ ABORT("Corrupted tail alloc canary."); \ } \ } while (0) +*/ #define CHECK_PTR_EXPR(_p) ({ \ typeof (_p) _tmp = (_p); \ -- cgit 1.4.1