]> 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)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Wed, 11 Sep 2024 08:00:08 +0000 (18:00 +1000)
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 e91d7e4192e796302d9f7f356a07290b0a2669b3..543e1247d6095b4ac22c1d6e859491a32a9d37c0 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);