Skip to content

Commit

Permalink
tls: debug messages with memory management functions
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Jun 24, 2021
1 parent 2a9e8b9 commit 81ace1c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modules/tls/tls_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@ int tls_pre_init(void)
* this has to be called before any function calling CRYPTO_malloc,
* CRYPTO_malloc will set allow_customize in openssl to 0
*/
CRYPTO_get_mem_functions(&mf, &rf, &ff);
LM_DBG("initial memory functions - malloc: %p realloc: %p free: %p\n",
mf, rf, ff);
mf = NULL;
rf = NULL;
ff = NULL;
#ifdef TLS_MALLOC_DBG
if (!CRYPTO_set_mem_ex_functions(ser_malloc, ser_realloc, ser_free)) {
#else
Expand All @@ -602,10 +608,14 @@ int tls_pre_init(void)
CRYPTO_get_mem_functions(&mf, &rf, &ff);
LM_ERR("libssl current mem functions - m: %p r: %p f: %p\n",
mf, rf, ff);
LM_ERR("module mem functions - m: %p r: %p f: %p\n",
ser_malloc, ser_realloc, ser_free);
LM_ERR("Be sure tls module is loaded before any other module using"
" libssl (can be loaded first to be safe)\n");
return -1;
}
LM_DBG("updated memory functions - malloc: %p realloc: %p free: %p\n",
ser_malloc, ser_realloc, ser_free);
#endif /* LIBRESSL_VERSION_NUMBER */

if (tls_init_locks()<0)
Expand Down

0 comments on commit 81ace1c

Please sign in to comment.