Prechádzať zdrojové kódy

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
Eric Andersen 20 rokov pred
rodič
commit
2f025ae954
1 zmenil súbory, kde vykonal 3 pridanie a 0 odobranie
  1. 3 0
      libc/stdlib/malloc-standard/malloc.h

+ 3 - 0
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;                                                         \
 }