From: Hugo Landau Date: Mon, 5 Feb 2024 14:19:46 +0000 (+0000) Subject: QUIC APL: Free listeners correctly X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c3cc20315d2749e14be58ea98345145376a860e;p=thirdparty%2Fopenssl.git QUIC APL: Free listeners correctly Reviewed-by: Matt Caswell Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/23334) --- diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index e91d7e4192e..543e1247d60 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -556,6 +556,14 @@ static void qc_cleanup(QUIC_CONNECTION *qc, int have_lock) } /* SSL_free */ +QUIC_TAKES_LOCK +static void quic_free_listener(QCTX *ctx) +{ + ossl_quic_port_free(ctx->ql->port); + ossl_quic_engine_free(ctx->ql->engine); + ossl_crypto_mutex_free(&ctx->ql->mutex); +} + QUIC_TAKES_LOCK void ossl_quic_free(SSL *s) { @@ -563,8 +571,13 @@ void ossl_quic_free(SSL *s) int is_default; /* We should never be called on anything but a QSO. */ - if (!expect_quic(s, &ctx)) + if (!expect_quic_any(s, &ctx)) + return; + + if (ctx.is_listener) { + quic_free_listener(&ctx); return; + } qctx_lock(&ctx);