[uClibc] Patch to malloc-standard

Erik Andersen andersen at codepoet.org
Fri Jan 30 21:56:30 UTC 2004


On Thu Jan 29, 2004 at 07:19:52PM +0100, Peter S. Mazinger wrote:
> Hello!
> 
> Gentoo applies the attached (OWL/openwall) patch to glibc's malloc. I have 
> checked malloc-standard/malloc.h (not malloc.c), it would apply there.

Not sure if you noticed, but there is no "abort-instr.h" header.
It makes a lot more sense to just call abort() directly here
anyways rather than trying to reimplement a local mini-abort().

Something like this seems more sensible:

--- uClibc/libc/stdlib/malloc-standard/malloc.h	30 Dec 2003 10:40:49 -0000	1.1
+++ uClibc/libc/stdlib/malloc-standard/malloc.h	30 Jan 2004 21:54:22 -0000
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <string.h>
 #include <malloc.h>
+#include <stdlib.h>
 
 
 #ifdef __UCLIBC_HAS_THREADS__
@@ -636,6 +637,8 @@
 #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;                                                         \
 }

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list