]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ssl/quic/quic_port.c: fix leak in port_make_channel()
authorhuanghuihui0904 <625173@qq.com>
Mon, 16 Mar 2026 06:46:20 +0000 (14:46 +0800)
committerNikola Pajkovsky <nikolap@openssl.org>
Mon, 27 Apr 2026 07:21:04 +0000 (07:21 +0000)
Free pre-existing ch->qlog_title before OPENSSL_strdup to avoid
leaking the value allocated in ossl_quic_channel_alloc(). Use
ossl_quic_channel_free() on strdup failure to ensure proper cleanup.

Solves https://github.com/openssl/openssl/issues/30440

Fixes #30440

Signed-off-by: huanghuihui0904 <625173@qq.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
MergeDate: Mon Apr 27 07:21:11 2026
(Merged from https://github.com/openssl/openssl/pull/30441)

ssl/quic/quic_port.c

index e9af8b21b21f8495541050e085e682ea1e2bb9c5..d4f40a95618eb97d1d231dc006f75360be566062 100644 (file)
@@ -610,8 +610,9 @@ static QUIC_CHANNEL *port_make_channel(QUIC_PORT *port, SSL *tls, OSSL_QRX *qrx,
      */
     ch->use_qlog = 1;
     if (ch->tls != NULL && ch->tls->ctx->qlog_title != NULL) {
+        OPENSSL_free(ch->qlog_title);
         if ((ch->qlog_title = OPENSSL_strdup(ch->tls->ctx->qlog_title)) == NULL) {
-            OPENSSL_free(ch);
+            ossl_quic_channel_free(ch);
             return NULL;
         }
     }