diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 62e5fe2469..873db60dd5 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.209 2016/10/31 10:06:56 otto Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.210 2016/11/03 18:51:49 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> |
@@ -1039,7 +1039,7 @@ find_chunknum(struct dir_info *d, struct region_info *r, void *ptr, int check) | |||
1039 | 1039 | ||
1040 | /* Find the chunk number on the page */ | 1040 | /* Find the chunk number on the page */ |
1041 | chunknum = ((uintptr_t)ptr & MALLOC_PAGEMASK) >> info->shift; | 1041 | chunknum = ((uintptr_t)ptr & MALLOC_PAGEMASK) >> info->shift; |
1042 | if (check && mopts.chunk_canaries && info->size > 0) { | 1042 | if (check && info->size > 0) { |
1043 | validate_canary(d, ptr, info->bits[info->offset + chunknum], | 1043 | validate_canary(d, ptr, info->bits[info->offset + chunknum], |
1044 | info->size); | 1044 | info->size); |
1045 | } | 1045 | } |
@@ -1343,8 +1343,10 @@ ofree(struct dir_info *argpool, void *p) | |||
1343 | void *tmp; | 1343 | void *tmp; |
1344 | int i; | 1344 | int i; |
1345 | 1345 | ||
1346 | /* Delayed free or canaries? Extra check */ | ||
1347 | if (!mopts.malloc_freenow || mopts.chunk_canaries) | ||
1348 | find_chunknum(pool, r, p, mopts.chunk_canaries); | ||
1346 | if (!mopts.malloc_freenow) { | 1349 | if (!mopts.malloc_freenow) { |
1347 | find_chunknum(pool, r, p, 1); | ||
1348 | if (mopts.malloc_junk && sz > 0) | 1350 | if (mopts.malloc_junk && sz > 0) |
1349 | memset(p, SOME_FREEJUNK, sz); | 1351 | memset(p, SOME_FREEJUNK, sz); |
1350 | i = getrbyte(pool) & MALLOC_DELAYED_CHUNK_MASK; | 1352 | i = getrbyte(pool) & MALLOC_DELAYED_CHUNK_MASK; |