From: Matt Caswell Date: Mon, 27 Aug 2018 13:52:09 +0000 (+0100) Subject: Fix a mem leak on error in the PSK code X-Git-Tag: OpenSSL_1_1_1~77 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c2cb1a18e00fc0a9a44d9a83134e3d3b1bfb7454;p=oweals%2Fopenssl.git Fix a mem leak on error in the PSK code Thanks to @fangang190 for reporting this issue. Fixes #7060 Reviewed-by: Paul Yang (Merged from https://github.com/openssl/openssl/pull/7065) --- diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 5ecbc3c554..7713f767b2 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -4621,6 +4621,7 @@ int ssl_generate_master_secret(SSL *s, unsigned char *pms, size_t pmslen, if (!s->method->ssl3_enc->generate_master_secret(s, s->session->master_key,pskpms, pskpmslen, &s->session->master_key_length)) { + OPENSSL_clear_free(pskpms, pskpmslen); /* SSLfatal() already called */ goto err; }