Skip to content

Instantly share code, notes, and snippets.

@razvancrainea
Last active July 7, 2020 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save razvancrainea/35d4b039dadc9349941f to your computer and use it in GitHub Desktop.
Save razvancrainea/35d4b039dadc9349941f to your computer and use it in GitHub Desktop.
proto_tls_mem_debug.patch
diff --git a/modules/proto_tls/proto_tls.c b/modules/proto_tls/proto_tls.c
index 205463d..7e1d7d7 100644
--- a/modules/proto_tls/proto_tls.c
+++ b/modules/proto_tls/proto_tls.c
@@ -1048,7 +1048,13 @@ static int mod_init(void)
* CRYPTO_malloc will set allow_customize in openssl to 0
*/
if (!CRYPTO_set_mem_functions(os_malloc, os_realloc, os_free)) {
- LM_ERR("unable to set the memory allocation functions\n");
+ /* we first need to check what alloc functions we have */
+ void *(*m)(size_t);
+ void *(*r)(void *, size_t);
+ void (*f)(void *);
+ CRYPTO_get_mem_functions(&m, &r, &f);
+ LM_WARN("unable to set the memory allocation functions m=%p|%p|%p r=%p|%p|%p f=%p|%p|%p\n",
+ os_malloc, m, malloc, os_realloc, r, realloc, os_free, f, free);
return -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment