openssl: release ssl_session if sess_reuse_cb fails

Closes #19405
This commit is contained in:
x2018 2025-11-08 20:07:54 +08:00 committed by Daniel Stenberg
parent 019874f197
commit 239c389836
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -3775,8 +3775,10 @@ ossl_init_session_and_alpns(struct ossl_ctx *octx,
bool do_early_data = FALSE;
if(sess_reuse_cb) {
result = sess_reuse_cb(cf, data, &alpns, scs, &do_early_data);
if(result)
if(result) {
SSL_SESSION_free(ssl_session);
return result;
}
}
if(do_early_data) {
/* We only try the ALPN protocol the session used before,