Increment the reference count of sessions inside the lock.
Otherwise another thread may cause the session to be destroyed first. Change-Id: I2084a28ece11540e1b8f289553161d99395e2d1f Reviewed-on: https://boringssl-review.googlesource.com/5231 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
d98452d2db
commit
bed63548d1
@ -420,11 +420,10 @@ int ssl_get_prev_session(SSL *s, const struct ssl_early_callback_ctx *ctx) {
|
|||||||
|
|
||||||
CRYPTO_MUTEX_lock_read(&s->initial_ctx->lock);
|
CRYPTO_MUTEX_lock_read(&s->initial_ctx->lock);
|
||||||
ret = lh_SSL_SESSION_retrieve(s->initial_ctx->sessions, &data);
|
ret = lh_SSL_SESSION_retrieve(s->initial_ctx->sessions, &data);
|
||||||
CRYPTO_MUTEX_unlock(&s->initial_ctx->lock);
|
|
||||||
|
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
SSL_SESSION_up_ref(ret);
|
SSL_SESSION_up_ref(ret);
|
||||||
}
|
}
|
||||||
|
CRYPTO_MUTEX_unlock(&s->initial_ctx->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (try_session_cache && ret == NULL &&
|
if (try_session_cache && ret == NULL &&
|
||||||
|
Loading…
Reference in New Issue
Block a user