From: J Mohan Rao Arisankala Date: Fri, 21 Apr 2017 16:03:46 +0000 (+0530) Subject: Cleanup ctxs if callback fail to retrieve session ticket X-Git-Tag: OpenSSL_1_0_2o~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=874893375c023c2b394887cfb54d52837a29f7c5;p=openssl 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) --- 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 {