summaryrefslogtreecommitdiff
path: root/src/lib/libc
diff options
context:
space:
mode:
authorotto <>2017-07-10 09:44:16 +0000
committerotto <>2017-07-10 09:44:16 +0000
commit6cac308477ac21bbd4f999be22dccf5485be6cb2 (patch)
tree60d2f9f1908913610eae0f2e4f5ff42948552964 /src/lib/libc
parent6cc50d61aa43548ae9a84a222bf647b3ec6a7922 (diff)
downloadopenbsd-6cac308477ac21bbd4f999be22dccf5485be6cb2.tar.gz
openbsd-6cac308477ac21bbd4f999be22dccf5485be6cb2.tar.bz2
openbsd-6cac308477ac21bbd4f999be22dccf5485be6cb2.zip
one more instance of the previous commit; also initialize ->offset to a
definite value in the size == 0 case
Diffstat (limited to 'src/lib/libc')
-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