[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Matt Caswell matt at openssl.org
Tue Mar 21 10:57:19 UTC 2017


The branch OpenSSL_1_0_2-stable has been updated
       via  3f640ebd035006d44d6f7d0767bb6ebd1a2efcd5 (commit)
      from  2e5adeb2904dd68780fb154dbeb6e3efafb418bb (commit)


- Log -----------------------------------------------------------------
commit 3f640ebd035006d44d6f7d0767bb6ebd1a2efcd5
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Mar 21 09:53:02 2017 +0000

    Avoid a mem leak on error
    
    An internal error path could result in a memory leak. Also remove some redundant
    code.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/3003)

-----------------------------------------------------------------------

Summary of changes:
 ssl/s3_srvr.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index 976d6b6..773358e 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -1713,6 +1713,12 @@ int ssl3_send_server_key_exchange(SSL *s)
         if (type & SSL_kEECDH) {
             const EC_GROUP *group;
 
+            if (s->s3->tmp.ecdh != NULL) {
+                SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,
+                       ERR_R_INTERNAL_ERROR);
+                goto err;
+            }
+
             ecdhp = cert->ecdh_tmp;
             if (s->cert->ecdh_tmp_auto) {
                 /* Get NID of appropriate shared curve */
@@ -1733,17 +1739,7 @@ int ssl3_send_server_key_exchange(SSL *s)
                 goto f_err;
             }
 
-            if (s->s3->tmp.ecdh != NULL) {
-                SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,
-                       ERR_R_INTERNAL_ERROR);
-                goto err;
-            }
-
             /* Duplicate the ECDH structure. */
-            if (ecdhp == NULL) {
-                SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_ECDH_LIB);
-                goto err;
-            }
             if (s->cert->ecdh_tmp_auto)
                 ecdh = ecdhp;
             else if ((ecdh = EC_KEY_dup(ecdhp)) == NULL) {


More information about the openssl-commits mailing list