From 874893375c023c2b394887cfb54d52837a29f7c5 Mon Sep 17 00:00:00 2001 From: J Mohan Rao Arisankala Date: Fri, 21 Apr 2017 21:33:46 +0530 Subject: [PATCH] Cleanup ctxs if callback fail to retrieve session ticket If tlsext ticket decrypt callback returns error, cleanup ctxs Reviewed-by: Rich Salz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/3273) --- ssl/t1_lib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 1a4387b78e..82ad601924 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -3513,9 +3513,12 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, &ctx, &hctx, 0); if (rv < 0) - return -1; - if (rv == 0) + goto err; + if (rv == 0) { + HMAC_CTX_cleanup(&hctx); + EVP_CIPHER_CTX_cleanup(&ctx); return 2; + } if (rv == 2) renew_ticket = 1; } else { -- 2.40.0