]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: purge conn Rx packet list on release
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 20 Jun 2022 08:52:55 +0000 (10:52 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 20 Jun 2022 12:59:52 +0000 (14:59 +0200)
When releasing a quic_conn instance, free all remaining Rx packets in
quic_conn.rx.pkt_list. This partially fixes a memory leak on Rx packets
which can be observed after several QUIC connections establishment.

This should partially resolve github issue #1751.

It must be backported up to 2.6.

src/xprt_quic.c

index d78eecf279b3cacab9a739cbcd8a21d29f02fd83..b1ef28e292f0a4c68e4f05f7e1cab6f88f1da911 100644 (file)
@@ -4049,6 +4049,7 @@ static void quic_conn_release(struct quic_conn *qc)
        struct ssl_sock_ctx *conn_ctx;
        struct eb64_node *node;
        struct quic_tls_ctx *app_tls_ctx;
+       struct quic_rx_packet *pkt, *pktback;
 
        /* We must not free the quic-conn if the MUX is still allocated. */
        BUG_ON(qc->mux_state == QC_MUX_READY);
@@ -4068,6 +4069,12 @@ static void quic_conn_release(struct quic_conn *qc)
                qc_stream_desc_free(stream);
        }
 
+       /* Purge Rx packet list. */
+       list_for_each_entry_safe(pkt, pktback, &qc->rx.pkt_list, qc_rx_pkt_list) {
+               LIST_DELETE(&pkt->qc_rx_pkt_list);
+               pool_free(pool_head_quic_rx_packet, pkt);
+       }
+
        if (qc->idle_timer_task) {
                task_destroy(qc->idle_timer_task);
                qc->idle_timer_task = NULL;