From 1755f63188d7448c97a63de5f89751bd9855e459 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 17 Apr 2014 17:11:10 +0000 Subject: [PATCH] fix a potential double free ok miod@ --- lib/libssl/d1_srvr.c | 4 ++-- lib/libssl/src/ssl/d1_srvr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libssl/d1_srvr.c b/lib/libssl/d1_srvr.c index 9b87dcd0676..ce7b243c2db 100644 --- a/lib/libssl/d1_srvr.c +++ b/lib/libssl/d1_srvr.c @@ -1290,6 +1290,7 @@ dtls1_send_server_key_exchange(SSL *s) (unsigned char *)encodedPoint, encodedlen); free(encodedPoint); + encodedPoint = NULL; p += encodedlen; } #endif @@ -1397,8 +1398,7 @@ f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: #ifndef OPENSSL_NO_ECDH - if (encodedPoint != NULL) - free(encodedPoint); + free(encodedPoint); BN_CTX_free(bn_ctx); #endif EVP_MD_CTX_cleanup(&md_ctx); diff --git a/lib/libssl/src/ssl/d1_srvr.c b/lib/libssl/src/ssl/d1_srvr.c index 9b87dcd0676..ce7b243c2db 100644 --- a/lib/libssl/src/ssl/d1_srvr.c +++ b/lib/libssl/src/ssl/d1_srvr.c @@ -1290,6 +1290,7 @@ dtls1_send_server_key_exchange(SSL *s) (unsigned char *)encodedPoint, encodedlen); free(encodedPoint); + encodedPoint = NULL; p += encodedlen; } #endif @@ -1397,8 +1398,7 @@ f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: #ifndef OPENSSL_NO_ECDH - if (encodedPoint != NULL) - free(encodedPoint); + free(encodedPoint); BN_CTX_free(bn_ctx); #endif EVP_MD_CTX_cleanup(&md_ctx); -- 2.20.1