summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2008-02-20 18:31:35 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2008-02-20 18:31:35 +0000
commita7ba0924ae2eb011fe89230eaebfa5a81a55036b (patch)
treeeaec9ecfc7765d0a80a9c22844d2ae79a8a4e958 /lib
parent3487d32babc45276b6d73cf6ab059b93b5b937bd (diff)
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')
-rw-r--r--lib/libc/stdlib/malloc.c12
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();