From: Bernd Edlinger Date: Fri, 16 Mar 2018 20:12:22 +0000 (+0100) Subject: Fix a memory leak in tls1_mac X-Git-Tag: OpenSSL_1_1_1-pre3~49 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a080c3e816e923680e57e647b5cbc3896e8e8106;p=oweals%2Fopenssl.git Fix a memory leak in tls1_mac Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/5650) --- diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c index 4ffc84279d..fa902f30fb 100644 --- a/ssl/record/ssl3_record.c +++ b/ssl/record/ssl3_record.c @@ -1297,8 +1297,10 @@ int tls1_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int sending) mac_ctx = hash; } else { hmac = EVP_MD_CTX_new(); - if (hmac == NULL || !EVP_MD_CTX_copy(hmac, hash)) + if (hmac == NULL || !EVP_MD_CTX_copy(hmac, hash)) { + EVP_MD_CTX_free(hmac); return 0; + } mac_ctx = hmac; }