Browse code

tls: debug messages with memory management functions

(cherry picked from commit 81ace1c94369fb98081918acb55a6a13686784e3)

Daniel-Constantin Mierla authored on 24/06/2021 09:29:40
Showing 1 changed files
... ...
@@ -593,6 +593,12 @@ int tls_pre_init(void)
593 593
 	 * this has to be called before any function calling CRYPTO_malloc,
594 594
 	 * CRYPTO_malloc will set allow_customize in openssl to 0
595 595
 	 */
596
+	CRYPTO_get_mem_functions(&mf, &rf, &ff);
597
+	LM_DBG("initial memory functions - malloc: %p realloc: %p free: %p\n",
598
+			mf, rf, ff);
599
+	mf = NULL;
600
+	rf = NULL;
601
+	ff = NULL;
596 602
 #ifdef TLS_MALLOC_DBG
597 603
 	if (!CRYPTO_set_mem_ex_functions(ser_malloc, ser_realloc, ser_free)) {
598 604
 #else
... ...
@@ -602,10 +608,14 @@ int tls_pre_init(void)
602 608
 		CRYPTO_get_mem_functions(&mf, &rf, &ff);
603 609
 		LM_ERR("libssl current mem functions - m: %p r: %p f: %p\n",
604 610
 					mf, rf, ff);
611
+		LM_ERR("module mem functions - m: %p r: %p f: %p\n",
612
+					ser_malloc, ser_realloc, ser_free);
605 613
 		LM_ERR("Be sure tls module is loaded before any other module using"
606 614
 				" libssl (can be loaded first to be safe)\n");
607 615
 		return -1;
608 616
 	}
617
+	LM_DBG("updated memory functions - malloc: %p realloc: %p free: %p\n",
618
+			ser_malloc, ser_realloc, ser_free);
609 619
 #endif /* LIBRESSL_VERSION_NUMBER */
610 620
 
611 621
 	if (tls_init_locks()<0)