In ssl_ciph.c there is a static STACK called ssl_comp_methods, and it is not possible to free the memory allocated to this stack (as far as I can tell).

This isn't a big problem for normal applications as all allocated memory is freed when the process shuts down. However, I use OpenSSL in a Windows DLL which can be unloaded from a process (via the FreeLibrary system call), and when this happens, the memory used by ssl_comp_methods is never freed, so my DLL causes a slow leak over time if the host application repeatedly loads and unloads it.

I have added a function to ssl_ciph.c which calls sk_SSL_COMP_free(ssl_comp_methods), and I call this function from my DLL's shutdown routine, and there are no more memory leaks reported by either of the leak-checking addons I use.

Should I post my changes?

NB. My shutdown code is currently:
       ERR_remove_state(0);
       CONF_modules_unload(1);
       EVP_cleanup();
       CRYPTO_cleanup_all_ex_data();
       ERR_free_strings();
       SSL_COMP_free(); /* new function */

which is possibly slight overkill, but it works and I could not find anywhere clear in the OpenSSL documentation talking about exactly which cleanup functions need to be called (or what order to call them in).


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to