OpenSSL::SSL_library_init() memory leak OpenSSL::SSL_library_init() memory leak windows windows

OpenSSL::SSL_library_init() memory leak


To get rid of compilation error in Joe H's answer:

sk_SSL_COMP_free(SSL_COMP_get_compression_methods());


As I understand all the memory which is allocated during SSL_library_init() and SSL_load_error_strings() are stored in global variables and so it comes under the category of "Memory in Use" rather under the category of Memory leak as the memory is still accessible when the program is dying out.

One suggestion is that ERR_remove_state(0) must be called in each thread where SSL is used, because when you call the ERR_remove_state with argument 0, it just clears the error state for the current thread. Other calls appears good to me. If you could post, "two leaks" which are still being displayed by VLD, I can check.


To get rid of the final two memory blocks allocated in SSL_library_init()try:

sk_free(SSL_COMP_get_compression_methods());