Merge pull request #4142 from elms/fix/memtest

test: Fix memtest callbacks
This commit is contained in:
David Garske
2021-06-17 14:01:21 -07:00
committed by GitHub
2 changed files with 28 additions and 1 deletions

View File

@@ -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

View File

@@ -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);