]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
malloc: Enable assertions if UNIT_TEST is enabled
authorSean Anderson <seanga2@gmail.com>
Sun, 8 Oct 2023 02:01:56 +0000 (22:01 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 11 Oct 2023 17:22:29 +0000 (13:22 -0400)
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>
common/dlmalloc.c

index 87a09d38fb34e01ccd1de9a0204e95427f9a059a..de3f04225f409569f69537a26252e45bdd56867b 100644 (file)
@@ -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>