linamh/sys-libs/glibc/files/2.3.2/glibc-2.3.2-owl-malloc-unlink-sanity-check.diff
2009-09-12 08:46:08 +00:00

30 lines
1.4 KiB
Diff

--- malloc/malloc.c.orig 2004-01-03 18:36:23.000000000 -0500
+++ malloc/malloc.c 2004-01-03 18:46:16.000000000 -0500
@@ -311,6 +311,11 @@ extern "C" {
#define assert(x) ((void)0)
#endif
+/* needed for owl-malloc-unlink-sanity-check */
+#include <abort-instr.h>
+#ifndef ABORT_INSTRUCTION
+#define ABORT_INSTRUCTION
+#endif
/*
INTERNAL_SIZE_T is the word-size used for internal bookkeeping
@@ -1951,6 +1956,14 @@ typedef struct malloc_chunk* mbinptr;
#define unlink(P, BK, FD) { \
FD = P->fd; \
BK = P->bk; \
+ /* owl-malloc-unlink-sanity-check */ \
+ if (FD->bk != P || BK->fd != P) \
+ { \
+ ABORT_INSTRUCTION; \
+ _exit(127); \
+ while (1) \
+ ABORT_INSTRUCTION; \
+ } \
FD->bk = BK; \
BK->fd = FD; \
}