Minor fix to BIO refcount handling

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23334)
This commit is contained in:
Hugo Landau 2024-01-18 16:33:27 +00:00 committed by Neil Horman
parent d1e81ca94c
commit d2ee7ceff0
2 changed files with 13 additions and 3 deletions

View file

@ -199,7 +199,7 @@ OSSL_QUIC_server_method() was added in OpenSSL @VERSION_QUIC_SERVER@.
=head1 COPYRIGHT
Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.
Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy

View file

@ -527,8 +527,18 @@ static void qc_cleanup(QUIC_CONNECTION *qc, int have_lock)
ossl_quic_channel_free(qc->ch);
qc->ch = NULL;
ossl_quic_port_free(qc->port);
qc->port = NULL;
if (qc->port != NULL) {
BIO *b;
b = ossl_quic_port_get_net_rbio(qc->port);
BIO_free_all(b);
b = ossl_quic_port_get_net_wbio(qc->port);
BIO_free_all(b);
ossl_quic_port_free(qc->port);
qc->port = NULL;
}
ossl_quic_engine_free(qc->engine);
qc->engine = NULL;