diff options
Diffstat (limited to 'src/lib/libssl/d1_lib.c')
| -rw-r--r-- | src/lib/libssl/d1_lib.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c index 758f5195e6..a728944047 100644 --- a/src/lib/libssl/d1_lib.c +++ b/src/lib/libssl/d1_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: d1_lib.c,v 1.47 2020/09/24 17:59:54 jsing Exp $ */ | 1 | /* $OpenBSD: d1_lib.c,v 1.48 2020/09/26 07:36:51 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * DTLS implementation written by Nagendra Modadugu | 3 | * DTLS implementation written by Nagendra Modadugu |
| 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. |
| @@ -124,46 +124,47 @@ dtls1_new(SSL *s) | |||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static void | 126 | static void |
| 127 | dtls1_clear_queues(SSL *s) | 127 | dtls1_drain_records(pqueue queue) |
| 128 | { | 128 | { |
| 129 | pitem *item = NULL; | 129 | pitem *item; |
| 130 | hm_fragment *frag = NULL; | ||
| 131 | DTLS1_RECORD_DATA_INTERNAL *rdata; | 130 | DTLS1_RECORD_DATA_INTERNAL *rdata; |
| 132 | 131 | ||
| 133 | while ((item = pqueue_pop(D1I(s)->unprocessed_rcds.q)) != NULL) { | 132 | if (queue == NULL) |
| 134 | rdata = (DTLS1_RECORD_DATA_INTERNAL *) item->data; | 133 | return; |
| 135 | ssl3_release_buffer(&rdata->rbuf); | ||
| 136 | free(item->data); | ||
| 137 | pitem_free(item); | ||
| 138 | } | ||
| 139 | 134 | ||
| 140 | while ((item = pqueue_pop(D1I(s)->processed_rcds.q)) != NULL) { | 135 | while ((item = pqueue_pop(queue)) != NULL) { |
| 141 | rdata = (DTLS1_RECORD_DATA_INTERNAL *) item->data; | 136 | rdata = (DTLS1_RECORD_DATA_INTERNAL *)item->data; |
| 142 | ssl3_release_buffer(&rdata->rbuf); | 137 | ssl3_release_buffer(&rdata->rbuf); |
| 143 | free(item->data); | 138 | free(item->data); |
| 144 | pitem_free(item); | 139 | pitem_free(item); |
| 145 | } | 140 | } |
| 141 | } | ||
| 146 | 142 | ||
| 147 | while ((item = pqueue_pop(D1I(s)->buffered_messages)) != NULL) { | 143 | static void |
| 148 | frag = (hm_fragment *)item->data; | 144 | dtls1_drain_fragments(pqueue queue) |
| 149 | free(frag->fragment); | 145 | { |
| 150 | free(frag); | 146 | pitem *item; |
| 151 | pitem_free(item); | 147 | hm_fragment *frag; |
| 152 | } | 148 | |
| 149 | if (queue == NULL) | ||
| 150 | return; | ||
| 153 | 151 | ||
| 154 | while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) { | 152 | while ((item = pqueue_pop(queue)) != NULL) { |
| 155 | frag = (hm_fragment *)item->data; | 153 | frag = (hm_fragment *)item->data; |
| 156 | free(frag->fragment); | 154 | free(frag->fragment); |
| 157 | free(frag); | 155 | free(frag); |
| 158 | pitem_free(item); | 156 | pitem_free(item); |
| 159 | } | 157 | } |
| 158 | } | ||
| 160 | 159 | ||
| 161 | while ((item = pqueue_pop(D1I(s)->buffered_app_data.q)) != NULL) { | 160 | static void |
| 162 | rdata = (DTLS1_RECORD_DATA_INTERNAL *) item->data; | 161 | dtls1_clear_queues(SSL *s) |
| 163 | ssl3_release_buffer(&rdata->rbuf); | 162 | { |
| 164 | free(item->data); | 163 | dtls1_drain_records(D1I(s)->unprocessed_rcds.q); |
| 165 | pitem_free(item); | 164 | dtls1_drain_records(D1I(s)->processed_rcds.q); |
| 166 | } | 165 | dtls1_drain_fragments(D1I(s)->buffered_messages); |
| 166 | dtls1_drain_fragments(s->d1->sent_messages); | ||
| 167 | dtls1_drain_records(D1I(s)->buffered_app_data.q); | ||
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | void | 170 | void |
