Fix a memory leak
authorMatt Caswell <matt@openssl.org>
Mon, 5 Dec 2016 17:31:37 +0000 (17:31 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 8 Dec 2016 17:20:34 +0000 (17:20 +0000)
When we call tls_collect_extensions() we need to free up the raw
extensions data later.

Perl changes reviewed by Richard Levitte. Non-perl changes reviewed by Rich
Salz

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
ssl/statem/statem_clnt.c

index c47c9aa51896dd5fae6e28d95ef984b5aab27921..38b8ecb290e7c427c39b7597245e7994dc5b32a4 100644 (file)
@@ -1352,10 +1352,12 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
         goto f_err;
     }
 
+    OPENSSL_free(extensions);
     return MSG_PROCESS_CONTINUE_READING;
  f_err:
     ssl3_send_alert(s, SSL3_AL_FATAL, al);
     ossl_statem_set_error(s);
+    OPENSSL_free(extensions);
     return MSG_PROCESS_ERROR;
 }
 
@@ -3117,11 +3119,13 @@ static MSG_PROCESS_RETURN tls_process_encrypted_extensions(SSL *s, PACKET *pkt)
                                          rawexts, &al))
         goto err;
 
+    OPENSSL_free(rawexts);
     return MSG_PROCESS_CONTINUE_READING;
 
  err:
     ssl3_send_alert(s, SSL3_AL_FATAL, al);
     ossl_statem_set_error(s);
+    OPENSSL_free(rawexts);
     return MSG_PROCESS_ERROR;
 }