Hi. I am using openssl 1.0.2 to do some ssl connection, now I am facing some memory leak issue. ssl = SSL_new(m_ctx); sbio = BIO_new_socket(server, BIO_NOCLOSE); SSL_set_bio(ssl,sbio,sbio); .... SSL_connect() ... //After handle, release resource if(ssl) SSL_shutdown(ssl); Now I have some questions about above code as I think there is some leak in it. 1) As I used BIO_NOCLOSE, should I free for BIO_new_socket 2) from SSL_shutdown. I found below, so Should I call SSL_shutdown twice? 0 The shutdown is not yet finished. Call SSL_shutdown() for a second time, if a bidirectional shutdown shall be performed. The output of SSL_get_error may be misleading, as an erroneous SSL_ERROR_SYSCALL may be flagged even though no error occurred. 3) It seems I missing SSL_free(), So when I do not need this ssl object, I should call SSL_free(), right? Thanks! -- Rejoice,I Desire!