free the Post-Handshake Auth digest when there is an error saving the digest

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16917)
This commit is contained in:
x2018 2021-10-26 11:31:11 +08:00 committed by Tomas Mraz
parent f541419c79
commit 963eb12dbd

View File

@ -2381,6 +2381,8 @@ int tls13_save_handshake_digest_for_pha(SSL *s)
if (!EVP_MD_CTX_copy_ex(s->pha_dgst,
s->s3.handshake_dgst)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
EVP_MD_CTX_free(s->pha_dgst);
s->pha_dgst = NULL;
return 0;
}
}