From 412c84799c9e1b237ff01dd8635b0003f49088f0 Mon Sep 17 00:00:00 2001 From: otto <> Date: Wed, 20 Feb 2008 18:31:34 +0000 Subject: [PATCH] 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@ --- src/lib/libc/stdlib/malloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 08b8a088..8348b7ed 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/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();