diff options
author | 2017-04-13 18:32:55 +0000 | |
---|---|---|
committer | 2017-04-13 18:32:55 +0000 | |
commit | b3570ff114d4897e8bd4b3065686850e48de77aa (patch) | |
tree | 43abc4a0b7442ec46f559837170fad0e280bbe8e /lib/libc/stdlib/malloc.c | |
parent | moving some code into a switch meant that break no longer stopped the loop. (diff) | |
download | wireguard-openbsd-b3570ff114d4897e8bd4b3065686850e48de77aa.tar.xz wireguard-openbsd-b3570ff114d4897e8bd4b3065686850e48de77aa.zip |
allow clearing less than allocated and document freezero(3) better
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 07c73ca7741..ecac7ddfe90 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.220 2017/04/10 05:45:02 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.221 2017/04/13 18:32:55 otto Exp $ */ /* * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> @@ -1340,15 +1340,15 @@ ofree(struct dir_info *argpool, void *p, int clear, int check, size_t argsz) uint32_t chunknum = find_chunknum(pool, r, p, 0); - if (info->bits[info->offset + chunknum] != + if (info->bits[info->offset + chunknum] < argsz) wrterror(pool, "recorded old size %hu" - " != %zu", + " < %zu", info->bits[info->offset + chunknum], argsz); } - } else if (argsz != sz - mopts.malloc_guard) - wrterror(pool, "recorded old size %zu != %zu", + } else if (sz - mopts.malloc_guard < argsz) + wrterror(pool, "recorded old size %zu < %zu", sz - mopts.malloc_guard, argsz); } if (sz > MALLOC_MAXCHUNK) { |