aboutsummaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorGravatar Eric Andersen <andersen@codepoet.org>2004-08-25 23:46:46 +0000
committerGravatar Eric Andersen <andersen@codepoet.org>2004-08-25 23:46:46 +0000
commit2f025ae954d4f08ab8e47e293f1ed7543f5edb40 (patch)
tree8ae2c2adc0640cf06f205c1ba55994197e1ec578 /libc/stdlib
parenta77ace03480be878bd8192f084a75d2034901b66 (diff)
downloaduClibc-2f025ae954d4f08ab8e47e293f1ed7543f5edb40.tar.gz
uClibc-2f025ae954d4f08ab8e47e293f1ed7543f5edb40.tar.bz2
Mike Frysinger writes:
this was sent earlier in a different form: http://www.uclibc.org/lists/uclibc/2004-January/008136.html find attached a smaller version ... perhaps adding a fprintf to stderr before calling abort would be nice like in the glibc patch, but whatever glibc has since adopted a similar fix for their malloc (third hunk, line 1970) http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/malloc/malloc.c.diff?r1=1.121&r2=1.122&cvsroot=glibc&f=h -mike
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/malloc-standard/malloc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h
index 174dc01bd..fbc14924e 100644
--- a/libc/stdlib/malloc-standard/malloc.h
+++ b/libc/stdlib/malloc-standard/malloc.h
@@ -20,6 +20,7 @@
#include <errno.h>
#include <string.h>
#include <malloc.h>
+#include <stdlib.h>
#ifdef __UCLIBC_HAS_THREADS__
@@ -645,6 +646,8 @@ typedef struct malloc_chunk* mbinptr;
#define unlink(P, BK, FD) { \
FD = P->fd; \
BK = P->bk; \
+ if (FD->bk != P || BK->fd != P) \
+ abort(); \
FD->bk = BK; \
BK->fd = FD; \
}