From bc174b2101f5487c9ff79ddc044a2466b7da1036 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Thu, 17 Nov 2022 10:12:52 +0100 Subject: [PATCH] BUG/MEDIUM: quic: fix memleak for out-of-order crypto data Liberate quic_enc_level ncbuf in quic_stream_free(). In most cases, this will already be done when handshake is completed via qc_treat_rx_crypto_frms(). However, if a connection is released before handshake completion, a leak was present without this patch. Under normal situation, this leak should have been limited due to the majority of QUIC connection success on handshake. However, another bug caused handshakes to fail too frequently, especially with chrome client. This had the side-effect to dramatically increase this memory leak. This should fix in part github issue #1903. --- src/quic_conn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/quic_conn.c b/src/quic_conn.c index 7fc2ecd43..a2b42c923 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -4478,6 +4478,8 @@ void quic_cstream_free(struct quic_cstream *cs) return; } + quic_free_ncbuf(&cs->rx.ncbuf); + qc_stream_desc_release(cs->desc); pool_free(pool_head_quic_cstream, cs); }