diff options
| author | jsing <> | 2020-09-26 14:43:17 +0000 |
|---|---|---|
| committer | jsing <> | 2020-09-26 14:43:17 +0000 |
| commit | b147e2d737372e25e4ae27eb3f3cf46c472e9055 (patch) | |
| tree | 3ab9fb4ff9a8215ce9b9bc92be9d1a9d42999a94 /src/lib/libssl/d1_lib.c | |
| parent | 16a00524267404e94d8c26a27dd54a75587920e7 (diff) | |
| download | openbsd-b147e2d737372e25e4ae27eb3f3cf46c472e9055.tar.gz openbsd-b147e2d737372e25e4ae27eb3f3cf46c472e9055.tar.bz2 openbsd-b147e2d737372e25e4ae27eb3f3cf46c472e9055.zip | |
Call dtls1_hm_fragment_free() from dtls1_drain_fragments()
Currently dtls1_drain_fragments() has a incomplete handrolled version of
dtls1_hm_fragment_free(), which has the potential to leak memory. Replace
the handrolled free with a call to dtls1_hm_fragment_free().
ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/d1_lib.c')
| -rw-r--r-- | src/lib/libssl/d1_lib.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c index b2f05452c8..b7d23ef4ca 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.49 2020/09/26 09:01:05 jsing Exp $ */ | 1 | /* $OpenBSD: d1_lib.c,v 1.50 2020/09/26 14:43:17 jsing 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. |
| @@ -70,6 +70,8 @@ | |||
| 70 | #include "pqueue.h" | 70 | #include "pqueue.h" |
| 71 | #include "ssl_locl.h" | 71 | #include "ssl_locl.h" |
| 72 | 72 | ||
| 73 | void dtls1_hm_fragment_free(hm_fragment *frag); | ||
| 74 | |||
| 73 | static int dtls1_listen(SSL *s, struct sockaddr *client); | 75 | static int dtls1_listen(SSL *s, struct sockaddr *client); |
| 74 | 76 | ||
| 75 | SSL3_ENC_METHOD DTLSv1_enc_data = { | 77 | SSL3_ENC_METHOD DTLSv1_enc_data = { |
| @@ -130,15 +132,12 @@ static void | |||
| 130 | dtls1_drain_fragments(pqueue queue) | 132 | dtls1_drain_fragments(pqueue queue) |
| 131 | { | 133 | { |
| 132 | pitem *item; | 134 | pitem *item; |
| 133 | hm_fragment *frag; | ||
| 134 | 135 | ||
| 135 | if (queue == NULL) | 136 | if (queue == NULL) |
| 136 | return; | 137 | return; |
| 137 | 138 | ||
| 138 | while ((item = pqueue_pop(queue)) != NULL) { | 139 | while ((item = pqueue_pop(queue)) != NULL) { |
| 139 | frag = (hm_fragment *)item->data; | 140 | dtls1_hm_fragment_free(item->data); |
| 140 | free(frag->fragment); | ||
| 141 | free(frag); | ||
| 142 | pitem_free(item); | 141 | pitem_free(item); |
| 143 | } | 142 | } |
| 144 | } | 143 | } |
