On 21/06/2022 11:42, Tomas Mraz wrote:
This is actually not a memory allocated by the SSL_CTX_new() itself but error string data that is global. There is no real memory leak here. You can call OPENSSL_cleanup() to explicitly de-allocate all the global data however please note that you can do it really only before immediate exit of the application using OpenSSL otherwise you risk crashes if something tries to call OpenSSL again after OPENSSL_cleanup() was called.
Better is to not call OPENSSL_cleanup() explicitly at all and just leave it. OPENSSL_cleanup() is called automatically at process exit.
Matt