diff options
| author | tdeval <> | 2003-07-19 23:52:27 +0000 |
|---|---|---|
| committer | tdeval <> | 2003-07-19 23:52:27 +0000 |
| commit | fafc86b23c8680c578fb4acd18ec162e12dd35ed (patch) | |
| tree | 85fd6b221ed5ffac8bfc9c58214ae2c02a6c7cf7 /src/lib/libc/stdlib/malloc.c | |
| parent | e36d49a61cc0658f944df0884567975689a8ba57 (diff) | |
| download | openbsd-fafc86b23c8680c578fb4acd18ec162e12dd35ed.tar.gz openbsd-fafc86b23c8680c578fb4acd18ec162e12dd35ed.tar.bz2 openbsd-fafc86b23c8680c578fb4acd18ec162e12dd35ed.zip | |
- just warn in case of mmap/brk failure
- extend_pgdir and malloc_make_chunks return int, not void*
ok tedu@
Diffstat (limited to 'src/lib/libc/stdlib/malloc.c')
| -rw-r--r-- | src/lib/libc/stdlib/malloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 3ce107857a..9d73ab021d 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #if defined(LIBC_SCCS) && !defined(lint) | 10 | #if defined(LIBC_SCCS) && !defined(lint) |
| 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.57 2003/07/13 08:35:44 otto Exp $"; | 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.58 2003/07/19 23:52:27 tdeval Exp $"; |
| 12 | #endif /* LIBC_SCCS and not lint */ | 12 | #endif /* LIBC_SCCS and not lint */ |
| 13 | 13 | ||
| 14 | /* | 14 | /* |
| @@ -385,7 +385,7 @@ map_pages(pages) | |||
| 385 | pages <<= malloc_pageshift; | 385 | pages <<= malloc_pageshift; |
| 386 | if (pages > SIZE_T_MAX - (size_t)result) { | 386 | if (pages > SIZE_T_MAX - (size_t)result) { |
| 387 | #ifdef MALLOC_EXTRA_SANITY | 387 | #ifdef MALLOC_EXTRA_SANITY |
| 388 | wrterror("(ES): overflow in map_pages fails\n"); | 388 | wrtwarning("(ES): overflow in map_pages fails\n"); |
| 389 | #endif /* MALLOC_EXTRA_SANITY */ | 389 | #endif /* MALLOC_EXTRA_SANITY */ |
| 390 | errno = ENOMEM; | 390 | errno = ENOMEM; |
| 391 | return (NULL); | 391 | return (NULL); |
| @@ -394,7 +394,7 @@ map_pages(pages) | |||
| 394 | 394 | ||
| 395 | if (brk(tail) == (char *)-1) { | 395 | if (brk(tail) == (char *)-1) { |
| 396 | #ifdef MALLOC_EXTRA_SANITY | 396 | #ifdef MALLOC_EXTRA_SANITY |
| 397 | wrterror("(ES): map_pages fails\n"); | 397 | wrtwarning("(ES): map_pages fails\n"); |
| 398 | #endif /* MALLOC_EXTRA_SANITY */ | 398 | #endif /* MALLOC_EXTRA_SANITY */ |
| 399 | return (NULL); | 399 | return (NULL); |
| 400 | } | 400 | } |
| @@ -402,7 +402,7 @@ map_pages(pages) | |||
| 402 | last_index = ptr2index(tail) - 1; | 402 | last_index = ptr2index(tail) - 1; |
| 403 | malloc_brk = tail; | 403 | malloc_brk = tail; |
| 404 | 404 | ||
| 405 | if ((last_index+1) >= malloc_ninfo && extend_pgdir(last_index) == NULL) | 405 | if ((last_index+1) >= malloc_ninfo && !extend_pgdir(last_index)) |
| 406 | return (NULL); | 406 | return (NULL); |
| 407 | 407 | ||
| 408 | return (result); | 408 | return (result); |
| @@ -790,7 +790,7 @@ malloc_bytes(size) | |||
| 790 | } | 790 | } |
| 791 | 791 | ||
| 792 | /* If it's empty, make a page more of that size chunks */ | 792 | /* If it's empty, make a page more of that size chunks */ |
| 793 | if (page_dir[j] == NULL && malloc_make_chunks(j) == NULL) | 793 | if (page_dir[j] == NULL && !malloc_make_chunks(j)) |
| 794 | return (NULL); | 794 | return (NULL); |
| 795 | 795 | ||
| 796 | bp = page_dir[j]; | 796 | bp = page_dir[j]; |
