From: jsg Date: Thu, 17 Apr 2014 17:11:10 +0000 (+0000) Subject: fix a potential double free X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1755f63188d7448c97a63de5f89751bd9855e459;p=openbsd fix a potential double free ok miod@ --- 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);