Don't free the prev BIO prematurely
authorMatt Caswell <matt@openssl.org>
Tue, 15 Aug 2023 14:33:34 +0000 (15:33 +0100)
committerHugo Landau <hlandau@openssl.org>
Thu, 17 Aug 2023 07:06:43 +0000 (08:06 +0100)
commit92e3f43aec553145b4d4cbb4dbd3df9658a05bb4
treeafe3149698b098f08ca8064a400a82ea84090a37
parente16c0103083af676af8c5564bb21585d4574f992
Don't free the prev BIO prematurely

We shouldn't free the prev BIO in ssl_set_new_record_layer until it is
no longer referenced by s->rlayer.rrlnext.

Found by the reproducible error patch in #21668

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21741)
ssl/record/rec_layer_s3.c