diff options
author | 2008-02-20 18:31:34 +0000 | |
---|---|---|
committer | 2008-02-20 18:31:34 +0000 | |
commit | dbbadbd93164a764352798779e7dc5ea9a6f1206 (patch) | |
tree | 928ce07ba85266817339326dfe07243f2a876b7e /lib/libc/stdlib/malloc.c | |
parent | 4.3-beta (diff) | |
download | wireguard-openbsd-dbbadbd93164a764352798779e7dc5ea9a6f1206.tar.xz wireguard-openbsd-dbbadbd93164a764352798779e7dc5ea9a6f1206.zip |
use pgfree pool like other code does to reserve free list slots.
prevents a few "cannot free mem because i need mem to free mem"
scenarios (one found by weingart@). ok weingart@ millert@ miod@
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 08b8a088d0d..8348b7ede18 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.87 2007/09/03 14:37:02 millert Exp $ */ +/* $OpenBSD: malloc.c,v 1.88 2008/02/20 18:31:34 otto Exp $ */ /* * ---------------------------------------------------------------------------- @@ -260,7 +260,7 @@ static struct pginfo *pginfo_list; static struct pgfree *pgfree_list; static struct pgfree * -alloc_pgfree() +alloc_pgfree(void) { struct pgfree *p; int i; @@ -281,7 +281,7 @@ alloc_pgfree() } static struct pginfo * -alloc_pginfo() +alloc_pginfo(void) { struct pginfo *p; int i; @@ -1199,9 +1199,9 @@ imalloc(size_t size, int zero_fill) if (suicide) abort(); - /* does not matter if malloc_bytes fails */ + /* does not matter if alloc_pgfree() fails */ if (px == NULL) - px = malloc_bytes(sizeof *px); + px = alloc_pgfree(); if (malloc_ptrguard && size == PTR_SIZE) { ptralloc = 1; @@ -1840,7 +1840,7 @@ ifree(void *ptr) else free_bytes(ptr); - /* does not matter if malloc_bytes fails */ + /* does not matter if alloc_pgfree fails */ if (px == NULL) px = alloc_pgfree(); |