]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC APL: Free listeners correctly
authorHugo Landau <hlandau@openssl.org>
Mon, 5 Feb 2024 14:19:46 +0000 (14:19 +0000)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:32 +0000 (11:27 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23334)

ssl/quic/quic_impl.c

index 1cb44983b2f9e02c9a617961884c42f8e7cab78c..b732d2f3ebe93849435a3cd89a76bc999619de00 100644 (file)
@@ -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);