diff options
author | 2004-04-12 09:25:11 +0000 | |
---|---|---|
committer | 2004-04-12 09:25:11 +0000 | |
commit | cc11f4d886d59f5e34b240abd4f6741b5f7d7ae0 (patch) | |
tree | f98444a83e6fc56cf8a6e4e17233bb650c28b815 /lib/libc/stdlib/malloc.c | |
parent | Enable the memory arbiter before turning off the PXE restart. This (diff) | |
download | wireguard-openbsd-cc11f4d886d59f5e34b240abd4f6741b5f7d7ae0.tar.xz wireguard-openbsd-cc11f4d886d59f5e34b240abd4f6741b5f7d7ae0.zip |
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/malloc.c')
-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 |