This corrects the reference count handling in SSL_get_session.