From 1786861415f4494a38630584a8fbc9c939a024ce Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sat, 7 Oct 2023 22:01:56 -0400 Subject: [PATCH] malloc: Enable assertions if UNIT_TEST is enabled dlmalloc has some sanity checks it performs on free() which can help detect memory corruption. However, they are only enabled if DEBUG is defined before including common.h. Define DEBUG earlier if UNIT_TEST is enabled so that assertions are enabled in sandbox. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- common/dlmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 87a09d38fb..de3f04225f 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -8,14 +8,14 @@ * as file malloc-2.6.6.c. */ -#include -#include -#include - #if CONFIG_IS_ENABLED(UNIT_TEST) #define DEBUG #endif +#include +#include +#include + #include #include #include -- 2.39.5