Fixed memory leak due to incorrect freeing of DTLS reassembly bit mask
authorMatt Caswell <matt@openssl.org>
Tue, 25 Nov 2014 13:36:00 +0000 (13:36 +0000)
committerMatt Caswell <matt@openssl.org>
Wed, 26 Nov 2014 10:11:25 +0000 (10:11 +0000)
PR#3608

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 8a35dbb6d89a16d792b79b157b3e89443639ec94)

ssl/d1_both.c
ssl/d1_lib.c
ssl/ssl_locl.h

index 3819527e743bdeffd84a50be721a143fd2d8f7d9..6132086d303652d65991bb7ad6a8c8ee0a8d04ad 100644 (file)
@@ -211,8 +211,7 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly)
        return frag;
        }
 
-static void
-dtls1_hm_fragment_free(hm_fragment *frag)
+void dtls1_hm_fragment_free(hm_fragment *frag)
        {
 
        if (frag->msg_header.is_ccs)
index 25c58a8af9ad32f12f7d3692b0bd32c27f4ca092..a593c7859e772c83c9fb929136695aa6ee6334c8 100644 (file)
@@ -187,16 +187,14 @@ static void dtls1_clear_queues(SSL *s)
     while( (item = pqueue_pop(s->d1->buffered_messages)) != NULL)
         {
         frag = (hm_fragment *)item->data;
-        OPENSSL_free(frag->fragment);
-        OPENSSL_free(frag);
+        dtls1_hm_fragment_free(frag);
         pitem_free(item);
         }
 
     while ( (item = pqueue_pop(s->d1->sent_messages)) != NULL)
         {
         frag = (hm_fragment *)item->data;
-        OPENSSL_free(frag->fragment);
-        OPENSSL_free(frag);
+        dtls1_hm_fragment_free(frag);
         pitem_free(item);
         }
 
index f779af6aa386e6ff81cc2eac7303bafd69f70c15..ed0a1584b338cdb6ad9c457e7658833b15576d5c 100644 (file)
@@ -1202,6 +1202,7 @@ int dtls1_is_timer_expired(SSL *s);
 void dtls1_double_timeout(SSL *s);
 int dtls1_send_newsession_ticket(SSL *s);
 unsigned int dtls1_min_mtu(void);
+void dtls1_hm_fragment_free(hm_fragment *frag);
 
 /* some client-only functions */
 int ssl3_client_hello(SSL *s);