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:10:21 +0000 (10:10 +0000)
PR#3608

Reviewed-by: Tim Hudson <tjh@openssl.org>
ssl/d1_both.c
ssl/d1_lib.c
ssl/ssl_locl.h

index f2ff94300135ea1b3e405c0712dbdf28513a14d5..2324675579f4df1538414d07a2cb9e1aa8d4470f 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 5f7a3582cc4b3ee34e63e6c00d04446b79028c41..ab8730c8838b11735a3f96e68adc74f2af3b23cd 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 0600f375b9bdbb17f66a90862734a33a2262bb0c..c5de1930f403ccbee11bedce7735e5079d705a1d 100644 (file)
@@ -1219,6 +1219,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);