diff options
author | otto <> | 2008-02-20 18:31:34 +0000 |
---|---|---|
committer | otto <> | 2008-02-20 18:31:34 +0000 |
commit | af70d9f43988faac4e1d4c23c2ee82a7f1fc0776 (patch) | |
tree | 445f44dd06648e4813b5a676f2a6d4b1b986d666 /src | |
parent | d08c4e4910d78ef0ddd9e7917c1f2d61b0021d4a (diff) | |
download | openbsd-af70d9f43988faac4e1d4c23c2ee82a7f1fc0776.tar.gz openbsd-af70d9f43988faac4e1d4c23c2ee82a7f1fc0776.tar.bz2 openbsd-af70d9f43988faac4e1d4c23c2ee82a7f1fc0776.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 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 08b8a088d0..8348b7ede1 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc.c,v 1.87 2007/09/03 14:37:02 millert Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.88 2008/02/20 18:31:34 otto Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * ---------------------------------------------------------------------------- | 4 | * ---------------------------------------------------------------------------- |
@@ -260,7 +260,7 @@ static struct pginfo *pginfo_list; | |||
260 | static struct pgfree *pgfree_list; | 260 | static struct pgfree *pgfree_list; |
261 | 261 | ||
262 | static struct pgfree * | 262 | static struct pgfree * |
263 | alloc_pgfree() | 263 | alloc_pgfree(void) |
264 | { | 264 | { |
265 | struct pgfree *p; | 265 | struct pgfree *p; |
266 | int i; | 266 | int i; |
@@ -281,7 +281,7 @@ alloc_pgfree() | |||
281 | } | 281 | } |
282 | 282 | ||
283 | static struct pginfo * | 283 | static struct pginfo * |
284 | alloc_pginfo() | 284 | alloc_pginfo(void) |
285 | { | 285 | { |
286 | struct pginfo *p; | 286 | struct pginfo *p; |
287 | int i; | 287 | int i; |
@@ -1199,9 +1199,9 @@ imalloc(size_t size, int zero_fill) | |||
1199 | if (suicide) | 1199 | if (suicide) |
1200 | abort(); | 1200 | abort(); |
1201 | 1201 | ||
1202 | /* does not matter if malloc_bytes fails */ | 1202 | /* does not matter if alloc_pgfree() fails */ |
1203 | if (px == NULL) | 1203 | if (px == NULL) |
1204 | px = malloc_bytes(sizeof *px); | 1204 | px = alloc_pgfree(); |
1205 | 1205 | ||
1206 | if (malloc_ptrguard && size == PTR_SIZE) { | 1206 | if (malloc_ptrguard && size == PTR_SIZE) { |
1207 | ptralloc = 1; | 1207 | ptralloc = 1; |
@@ -1840,7 +1840,7 @@ ifree(void *ptr) | |||
1840 | else | 1840 | else |
1841 | free_bytes(ptr); | 1841 | free_bytes(ptr); |
1842 | 1842 | ||
1843 | /* does not matter if malloc_bytes fails */ | 1843 | /* does not matter if alloc_pgfree fails */ |
1844 | if (px == NULL) | 1844 | if (px == NULL) |
1845 | px = alloc_pgfree(); | 1845 | px = alloc_pgfree(); |
1846 | 1846 | ||