[sr-dev] git:master:81ace1c9: tls: debug messages with memory management functions

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 24 11:30:44 CEST 2021


Module: kamailio
Branch: master
Commit: 81ace1c94369fb98081918acb55a6a13686784e3
URL: https://github.com/kamailio/kamailio/commit/81ace1c94369fb98081918acb55a6a13686784e3

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-24T11:29:40+02:00

tls: debug messages with memory management functions

---

Modified: src/modules/tls/tls_init.c

---

Diff:  https://github.com/kamailio/kamailio/commit/81ace1c94369fb98081918acb55a6a13686784e3.diff
Patch: https://github.com/kamailio/kamailio/commit/81ace1c94369fb98081918acb55a6a13686784e3.patch

---

diff --git a/src/modules/tls/tls_init.c b/src/modules/tls/tls_init.c
index 8bdd14f2cc..b71bbbd28b 100644
--- a/src/modules/tls/tls_init.c
+++ b/src/modules/tls/tls_init.c
@@ -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
@@ -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)




More information about the sr-dev mailing list