Browse Source

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@
OPENBSD_4_3
otto 16 years ago
parent
commit
412c84799c
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      src/lib/libc/stdlib/malloc.c

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

@ -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();


Loading…
Cancel
Save