I apologize if this shows up more than once. I've been having problems
sending emails out, all day.
First I encountered this with valgrind but then I decided to have
openssl print the leaks and it was also confirmed.
I have reduced my code to the following two lines. Prior to this if
course initilization of openssl and then the cleanup. Either there's a
call that I'm missing or the the dynamic locks don't get cleaned up upon
exit. Looking at the code in cryptlib.c, i don't see anywhere freeing up
the memory allocated to the following stacks:
static STACK_OF(OPENSSL_STRING) *app_locks=NULL;
static STACK_OF(CRYPTO_dynlock) *dyn_locks=NULL;
And here's my sample code:
int l = CRYPTO_get_new_dynlockid();
CRYPTO_destroy_dynlockid(l);
Before this I have a bunch of lines like:
CRYPTO_malloc_debug_init();
CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
SSL_library_init();
OpenSSL_add_all_digests();
CRYPTO_set_id_callback(..);
CRYPTO_set_locking_callback(...);
CRYPTO_set_dynlock_create_callback(...);
CRYPTO_set_dynlock_lock_callback(...);
CRYPTO_set_dynlock_destroy_callback(...);
And at the end of the code I have something like:
CRYPTO_set_id_callback(NULL);
CRYPTO_set_locking_callback(NULL);
CRYPTO_set_dynlock_create_callback(NULL);
CRYPTO_set_dynlock_lock_callback(NULL);
CRYPTO_set_dynlock_destroy_callback(NULL);
ENGINE_cleanup();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
OBJ_NAME_cleanup(-1);
ERR_remove_thread_state(NULL);
SSL_free_comp_methods();
CRYPTO_mem_leaks_fp(stderr);
As you can see I have included every cleanup call I could find.
Running the code produces the following output:
[19:49:10] 188 file=stack.c, line=125, thread=19596, number=20,
address=08DF0E50
[19:49:10] 189 file=stack.c, line=127, thread=19596, number=16,
address=08DF0F78
36 bytes leaked in 2 chunks
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]