diff options
author | Thierry Deval <tdeval@cvs.openbsd.org> | 2004-04-12 09:25:12 +0000 |
---|---|---|
committer | Thierry Deval <tdeval@cvs.openbsd.org> | 2004-04-12 09:25:12 +0000 |
commit | 21a8d6128707a98bb50b5f029d61d77a4a03626b (patch) | |
tree | bea08f582ef8bd5955daafd99cf0be17cfe1a68a /lib/libc/stdlib | |
parent | 7a7e629be2d7b369449460d6d3b60a922de2c73d (diff) |
Clean up malloc_active state when aborting.
This allows for safe abort handling, without tripping into
false recursivity problems.
Ok tedu@, deraadt@
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index f5704754a0e..ffb74717e2c 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -8,7 +8,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: malloc.c,v 1.66 2004/02/19 23:20:53 tdeval Exp $"; +static char rcsid[] = "$OpenBSD: malloc.c,v 1.67 2004/04/12 09:25:11 tdeval Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -228,6 +228,9 @@ void utrace(struct ut *, int); #define UTRACE(a,b,c) #endif +/* Status of malloc. */ +static int malloc_active; + /* my last break. */ static void *malloc_brk; @@ -335,6 +338,7 @@ wrterror(char *p) if (malloc_stats) malloc_dump(stderr); #endif /* MALLOC_STATS */ + malloc_active--; abort(); } @@ -1243,8 +1247,6 @@ ifree(void *ptr) return; } -static int malloc_active; - /* * Common function for handling recursion. Only * print the error message once, to avoid making the problem |