summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2009-11-27 20:05:04 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2009-11-27 20:05:04 +0000
commitb5b5edebe52f3da6dcc3ebe2ed767d2269c40f6d (patch)
treea0aaa44208ef6493ae87ee8d645e68fddcda02a9 /lib/libc
parent4c2fffd770f9be43ef0e430e7306458326519ca2 (diff)
Don't forget to fill region from the cache with junk if needed in one case;
from Fabien Romano and Jonathan Armani
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/malloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 1743e20a894..f3f0a97c3a7 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/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 <otto@drijf.net>
*
@@ -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);