From: Matt Caswell Date: Thu, 18 Jan 2024 12:25:47 +0000 (+0000) Subject: Free the QUIC TLS object before freeing the channel X-Git-Tag: openssl-3.2.2~181 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=52154968f9e982c0baeb38a3a6baf56f882bd589;p=thirdparty%2Fopenssl.git Free the QUIC TLS object before freeing the channel Freeing the QUIC TLS object may make calls back into QUIC so we should free it first. Reviewed-by: Hugo Landau Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23256) (cherry picked from commit f7f2b665cf91650deb28beb1145ea3eca7df67aa) --- diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 399d1d2afd1..93fead15845 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -542,18 +542,22 @@ void ossl_quic_free(SSL *s) } #endif + SSL_free(ctx.qc->tls); + ossl_quic_channel_free(ctx.qc->ch); BIO_free_all(ctx.qc->net_rbio); BIO_free_all(ctx.qc->net_wbio); - /* Note: SSL_free calls OPENSSL_free(qc) for us */ - - SSL_free(ctx.qc->tls); quic_unlock(ctx.qc); /* tsan doesn't like freeing locked mutexes */ #if defined(OPENSSL_THREADS) ossl_crypto_mutex_free(&ctx.qc->mutex); #endif + + /* + * Note: SSL_free (that called this function) calls OPENSSL_free(ctx.qc) for + * us + */ } /* SSL method init */