I got a program which does the following sequence of operations -- SSL_shutdown(ssl) SSL_free (ssl); SSL_CTX_free ( ctx ); close(socket) Where 'socket' is the underlying non-blocking socket the ssl connection is established over. bio is also set to non-blocking. Sometimes, the program crashes when doing an SSL_CTX_free; before the crash, ctx is an invalid pointer, that's why I can get a valid value from SSL_CTX_get_max_cert_list (ctx), so it's not a double free problem. I tried removing SSL_shutdown(ssl) with no improvements.