From 5072a5f46592e55ee0c9f05a463073e519a16331 Mon Sep 17 00:00:00 2001 From: Matt Macy Date: Sat, 19 May 2018 04:43:49 +0000 Subject: [PATCH] malloc: avoid possibly returning stack garbage if MALLOC_DEBUG is defined --- sys/kern/kern_malloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index e6328039bced..93664e5476bb 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -559,6 +559,7 @@ malloc(size_t size, struct malloc_type *mtp, int flags) #endif #ifdef MALLOC_DEBUG + va = NULL; if (malloc_dbg(&va, &size, mtp, flags) != 0) return (va); #endif @@ -604,6 +605,7 @@ malloc_domain(size_t size, struct malloc_type *mtp, int domain, #endif #ifdef MALLOC_DEBUG + va = NULL; if (malloc_dbg(&va, &size, mtp, flags) != 0) return (va); #endif