Browse Source

Clean up malloc_active state when aborting.

This allows for safe abort handling, without tripping into
false recursivity problems.
Ok tedu@, deraadt@
OPENBSD_3_6
tdeval 21 years ago
parent
commit
55664fb425
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      src/lib/libc/stdlib/malloc.c

+ 5
- 3
src/lib/libc/stdlib/malloc.c View File

@ -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


Loading…
Cancel
Save