diff options
author | Matt Caswell <matt@openssl.org> | 2016-03-15 11:38:56 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-03-18 11:56:34 +0000 |
commit | 3b93479fcfd335622bb9e5e8cc08acd328750f44 (patch) | |
tree | a886bd6dd2d86f4e98f56f43b00f8f301ced2deb | |
parent | e78dc7e279ed98e1ab9845a70d14dafdfdc88f58 (diff) | |
download | openssl-new-3b93479fcfd335622bb9e5e8cc08acd328750f44.tar.gz |
Ensure that memory allocated for the ticket is freed
If a call to EVP_DecryptUpdate fails then a memory leak could occur.
Ensure that the memory is freed appropriately.
Issue reported by Guido Vranken.
Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r-- | ssl/t1_lib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index d9ba99d735..0e7a262a0d 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -3415,8 +3415,10 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx); sdec = OPENSSL_malloc(eticklen); - if (!sdec || EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) { + if (sdec == NULL + || EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) { EVP_CIPHER_CTX_cleanup(&ctx); + OPENSSL_free(sdec); return -1; } if (EVP_DecryptFinal(&ctx, sdec + slen, &mlen) <= 0) { |