]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux_quic: fix memory leak of rx app_buf on stream free flx04/master
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 26 Jun 2026 14:51:52 +0000 (16:51 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Fri, 26 Jun 2026 15:16:38 +0000 (17:16 +0200)
When freeing a QUIC stream (qcs), the receive application buffer
(qcs->rx.app_buf) was not released if it still contained data or
had been allocated. This led to a memory leak over time as streams
were opened and closed.

Fix this by explicitly freeing qcs->rx.app_buf via b_free() in
qcs_free() if its size is non-zero, and call offer_buffers() to
notify the buffer pool.

This should be backported as far as 2.6.

src/mux_quic.c

index c8a880450f2d6e4ace38234a6d6a1fcb5dcf5092..bfed86c4b84208f738936705b2276b252a9a49b0 100644 (file)
@@ -127,6 +127,11 @@ static void qcs_free(struct qcs *qcs)
                qcs_free_rxbuf(qcs, b);
        }
 
+       if (b_size(&qcs->rx.app_buf)) {
+               b_free(&qcs->rx.app_buf);
+               offer_buffers(NULL, 1);
+       }
+
        /* Remove qcs from qcc tree. */
        eb64_delete(&qcs->by_id);