Followup on RT3334 fix: make sure that a directory that's the empty
[openssl.git] / ssl / d1_lib.c
index f61f718183083ff23bcbb281c777ee6f9bd364ae..6bde16fa212c989591a0c46bc484ab864288cf66 100644 (file)
@@ -176,9 +176,12 @@ static void dtls1_clear_queues(SSL *s)
 
        while ( (item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL)
                {
-               frag = (hm_fragment *)item->data;
-               OPENSSL_free(frag->fragment);
-               OPENSSL_free(frag);
+               rdata = (DTLS1_RECORD_DATA *) item->data;
+               if (rdata->rbuf.buf)
+                       {
+                       OPENSSL_free(rdata->rbuf.buf);
+                       }
+               OPENSSL_free(item->data);
                pitem_free(item);
                }
        }
@@ -196,6 +199,7 @@ void dtls1_free(SSL *s)
        pqueue_free(s->d1->buffered_app_data.q);
 
        OPENSSL_free(s->d1);
+       s->d1 = NULL;
        }
 
 void dtls1_clear(SSL *s)