diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 525edb3289b7d8c7392e12f9192f61f4d33f549c..07237653668054f828682d0cccc7bc6eb72cd885 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -769,11 +769,11 @@ static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) if (lck) CRYPTO_THREAD_unlock(ctx->lock); - if (ret) - SSL_SESSION_free(r); - if (ctx->remove_session_cb != NULL) ctx->remove_session_cb(ctx, c); + + if (ret) + SSL_SESSION_free(r); } else ret = 0; return ret;