summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libc/stdlib/malloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index dc2c7b1500..22f83f3525 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.227 2017/07/07 19:14:46 otto Exp $ */ 1/* $OpenBSD: malloc.c,v 1.228 2017/07/10 09:44:16 otto Exp $ */
2/* 2/*
3 * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> 4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -886,6 +886,7 @@ omalloc_make_chunks(struct dir_info *d, int bits, int listnum)
886 while (i >>= 1) 886 while (i >>= 1)
887 bp->shift++; 887 bp->shift++;
888 bp->total = bp->free = MALLOC_PAGESIZE >> bp->shift; 888 bp->total = bp->free = MALLOC_PAGESIZE >> bp->shift;
889 bp->offset = 0xdead;
889 bp->page = pp; 890 bp->page = pp;
890 891
891 k = mprotect(pp, MALLOC_PAGESIZE, PROT_NONE); 892 k = mprotect(pp, MALLOC_PAGESIZE, PROT_NONE);
@@ -1793,7 +1794,7 @@ orecallocarray(struct dir_info *argpool, void *p, size_t oldsize,
1793 1794
1794 REALSIZE(sz, r); 1795 REALSIZE(sz, r);
1795 if (sz <= MALLOC_MAXCHUNK) { 1796 if (sz <= MALLOC_MAXCHUNK) {
1796 if (mopts.chunk_canaries) { 1797 if (mopts.chunk_canaries && sz > 0) {
1797 struct chunk_info *info = (struct chunk_info *)r->size; 1798 struct chunk_info *info = (struct chunk_info *)r->size;
1798 uint32_t chunknum = find_chunknum(pool, r, p, 0); 1799 uint32_t chunknum = find_chunknum(pool, r, p, 0);
1799 1800