diff options
author | Pauli <paul.dale@oracle.com> | 2020-09-14 07:36:02 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-09-16 07:22:43 +1000 |
commit | 48ff651eccf2f43ddbc221a0f9ddac57169aa255 (patch) | |
tree | 2a4c4e49a633606189dfa59d5e2015e3188189eb /ssl | |
parent | 4f14a378f807e989aa0b328267732409c8d6ac68 (diff) |
DTLS: free allocated memory on error paths
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/12870)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/statem/statem_dtls.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ssl/statem/statem_dtls.c b/ssl/statem/statem_dtls.c index 564829c808..84ae35b655 100644 --- a/ssl/statem/statem_dtls.c +++ b/ssl/statem/statem_dtls.c @@ -1051,12 +1051,16 @@ int dtls1_buffer_message(SSL *s, int is_ccs) if (!ossl_assert(s->d1->w_msg_hdr.msg_len + ((s->version == DTLS1_BAD_VER) ? 3 : DTLS1_CCS_HEADER_LENGTH) - == (unsigned int)s->init_num)) + == (unsigned int)s->init_num)) { + dtls1_hm_fragment_free(frag); return 0; + } } else { if (!ossl_assert(s->d1->w_msg_hdr.msg_len + - DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num)) + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num)) { + dtls1_hm_fragment_free(frag); return 0; + } } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; |