From 600b8b9fd56f389d5b5d4af8dcc4c2a121bf751b Mon Sep 17 00:00:00 2001 From: otto <> Date: Fri, 27 Nov 2009 20:05:03 +0000 Subject: [PATCH] Don't forget to fill region from the cache with junk if needed in one case; from Fabien Romano and Jonathan Armani --- src/lib/libc/stdlib/malloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 1743e20a..f3f0a97c 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.119 2009/11/27 19:59:49 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.120 2009/11/27 20:05:03 otto Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek * @@ -520,6 +520,8 @@ map(struct dir_info *d, size_t sz, int zero_fill) d->free_regions_size -= psz; if (zero_fill) memset(p, 0, sz); + else if (mopts.malloc_junk && mopts.malloc_freeprot) + memset(p, SOME_FREEJUNK, sz); return p; } p = MMAP(sz);