aboutsummaryrefslogtreecommitdiff
path: root/common/dlmalloc.c
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2023-10-07 22:01:56 -0400
committerTom Rini <trini@konsulko.com>2023-10-11 13:22:29 -0400
commit1786861415f4494a38630584a8fbc9c939a024ce (patch)
treebf49b2d39cf93afcec1694ee0c61c1945591fb5e /common/dlmalloc.c
parent9214da7b931e7ee150a2f1da80af2a20ce8194ab (diff)
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 <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/dlmalloc.c')
-rw-r--r--common/dlmalloc.c8
1 files 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 <common.h>
-#include <log.h>
-#include <asm/global_data.h>
-
#if CONFIG_IS_ENABLED(UNIT_TEST)
#define DEBUG
#endif
+#include <common.h>
+#include <log.h>
+#include <asm/global_data.h>
+
#include <malloc.h>
#include <asm/io.h>
#include <valgrind/memcheck.h>