diff options
Diffstat (limited to 'lib/libc/stdlib/atexit.c')
-rw-r--r-- | lib/libc/stdlib/atexit.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c index bbf374e..a65dae5 100644 --- a/lib/libc/stdlib/atexit.c +++ b/lib/libc/stdlib/atexit.c @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)atexit.c 8.2 (Berkeley) 7/3/94"; #include <stddef.h> #include <stdlib.h> +#include <unistd.h> #include "atexit.h" struct atexit *__atexit; /* points to head of LIFO stack */ @@ -57,7 +58,7 @@ atexit(fn) if ((p = __atexit) == NULL) __atexit = p = &__atexit0; else if (p->ind >= ATEXIT_SIZE) { - if ((p = malloc(sizeof(*p))) == NULL) + if ((p = (struct atexit *)sbrk(sizeof(*p))) == (struct atexit *)-1) return (-1); p->ind = 0; p->next = __atexit; |