Move freeing of an old enc_write_ctx/write_hash to dtls1_clear_sent_buffer
authorMatt Caswell <matt@openssl.org>
Thu, 9 Nov 2023 14:45:33 +0000 (14:45 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 24 Nov 2023 10:49:10 +0000 (10:49 +0000)
commit5e361b00c41a443c0c5954f7dd6f475d645b7f84
tree2a3bb336516a37bb8da48fe55c5d58e435f02ba1
parent02a2c3bc1336d2af1601fbc5d959c6babc1bce12
Move freeing of an old enc_write_ctx/write_hash to dtls1_clear_sent_buffer

When we are clearing the sent messages queue we should ensure we free any
old enc_write_ctx/write_hash that are no longer in use. Previously this
logic was in dtls1_hm_fragment_free() - but this can end up freeing the
current enc_write_ctx/write_hash under certain error conditions.

Fixes #22664

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2261)
ssl/d1_lib.c
ssl/ssl_lib.c
ssl/statem/statem_dtls.c