summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-02-01 10:07:49 +0000
committerphk <phk@FreeBSD.org>2003-02-01 10:07:49 +0000
commit7f4da3a28ce8851cbd875da4dd75d7216c74b9c1 (patch)
treecdc9f79aa1dce8023be995da1ce0ec06bcee4b8a /sys
parent2f5b4a19f3d32cf00ab39a28772484008afb06f0 (diff)
downloadFreeBSD-src-7f4da3a28ce8851cbd875da4dd75d7216c74b9c1.zip
FreeBSD-src-7f4da3a28ce8851cbd875da4dd75d7216c74b9c1.tar.gz
Under #ifdef DIAGNOSTIC, fill malloc(9) allocations which do not have
M_ZERO specified with 0x70. (malloc_flags=J for the kernel :-)
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_malloc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 6122a52..33d23f1 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -162,6 +162,9 @@ malloc(size, type, flags)
int indx;
caddr_t va;
uma_zone_t zone;
+#ifdef DIAGNOSTIC
+ unsigned long osize = size;
+#endif
register struct malloc_type *ksp = type;
#if 0
@@ -207,6 +210,11 @@ out:
if (va == NULL) {
t_malloc_fail = time_uptime;
}
+#ifdef DIAGNOSTIC
+ if (!(flags & M_ZERO)) {
+ memset(va, 0x70, osize);
+ }
+#endif
return ((void *) va);
}
OpenPOWER on IntegriCloud