]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-quic: ensure to free all qcs on MUX release
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 30 Mar 2022 09:51:56 +0000 (11:51 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 30 Mar 2022 14:12:18 +0000 (16:12 +0200)
Remove qcs instances left during qcc MUX release. This can happen when
the MUX is closed before the completion of all the transfers, such as on
a timeout or process termination.

This may free some memory leaks on the connection.

src/mux_quic.c

index e68b362b95036465101668ce6a10baf42852ec5d..40e26d65d7b75224ea2e9d1e3c2395732e2d2471 100644 (file)
@@ -475,6 +475,8 @@ static void qc_release(struct qcc *qcc)
        TRACE_ENTER(QMUX_EV_QCC_END);
 
        if (qcc) {
+               struct eb64_node *node;
+
                /* The connection must be aattached to this mux to be released */
                if (qcc->conn && qcc->conn->ctx == qcc)
                        conn = qcc->conn;
@@ -487,6 +489,14 @@ static void qc_release(struct qcc *qcc)
                if (qcc->wait_event.tasklet)
                        tasklet_free(qcc->wait_event.tasklet);
 
+               /* liberate remaining qcs instances */
+               node = eb64_first(&qcc->streams_by_id);
+               while (node) {
+                       struct qcs *qcs = eb64_entry(node, struct qcs, by_id);
+                       node = eb64_next(node);
+                       qcs_free(qcs);
+               }
+
                pool_free(pool_head_qcc, qcc);
        }