Fix a memory leak in tls1_mac Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5650)
diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c index 4ffc842..fa902f3 100644 --- a/ssl/record/ssl3_record.c +++ b/ssl/record/ssl3_record.c
@@ -1297,8 +1297,10 @@ 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; }