diff --git a/configure.ac b/configure.ac index 1509bf658..15849a904 100644 --- a/configure.ac +++ b/configure.ac @@ -5810,9 +5810,13 @@ AC_ARG_ENABLE([memtest], if test "x$ENABLED_MEMTEST" != "xno" then - AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY -DWOLFSSL_DEBUG_MEMORY -DWOLFSSL_FORCE_MALLOC_FAIL_TEST" + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TRACK_MEMORY -DWOLFSSL_DEBUG_MEMORY" fi +if test "x$ENABLED_MEMTEST" == "xfail" +then + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_FORCE_MALLOC_FAIL_TEST" +fi # Enable hash flags support # Hash flags are useful for runtime options such as SHA3 KECCAK256 selection diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 0d5b959f2..88f047123 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -36546,8 +36546,15 @@ static int malloc_cnt = 0; static int realloc_cnt = 0; static int free_cnt = 0; +#ifdef WOLFSSL_DEBUG_MEMORY +static void *my_Malloc_cb(size_t size, const char* func, unsigned int line) +{ + (void) func; + (void) line; +#else static void *my_Malloc_cb(size_t size) { +#endif malloc_cnt++; #ifndef WOLFSSL_NO_MALLOC return malloc(size); @@ -36557,8 +36564,16 @@ static void *my_Malloc_cb(size_t size) return NULL; #endif } + +#ifdef WOLFSSL_DEBUG_MEMORY +static void my_Free_cb(void *ptr, const char* func, unsigned int line) +{ + (void) func; + (void) line; +#else static void my_Free_cb(void *ptr) { +#endif free_cnt++; #ifndef WOLFSSL_NO_MALLOC free(ptr); @@ -36567,8 +36582,16 @@ static void my_Free_cb(void *ptr) (void)ptr; #endif } + +#ifdef WOLFSSL_DEBUG_MEMORY +static void *my_Realloc_cb(void *ptr, size_t size, const char* func, unsigned int line) +{ + (void) func; + (void) line; +#else static void *my_Realloc_cb(void *ptr, size_t size) { +#endif realloc_cnt++; #ifndef WOLFSSL_NO_MALLOC return realloc(ptr, size);