]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-quic: fix memleak on frames rejected by transport
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 10 Jun 2022 13:16:40 +0000 (15:16 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 10 Jun 2022 15:59:06 +0000 (17:59 +0200)
When the MUX transfers a big amount of data to the client, the transport
layer may reject some of them because of the congestion controller
limit. Frames built by the MUX are thus dropped, even if streams transferred
data are kept in buffers for future new frames.

Thus, the MUX is required to free rejected frames. This fixes a memory
leak which may grow with important data transfers.

It should be backported to 2.6 after it has been tested and validated.

src/mux_quic.c

index c5e2c9e92649be6bd5c84b0a13ae856d6a02215d..0b65b8f2c8a88d654a0401eca38ca161883af66e 100644 (file)
@@ -1173,6 +1173,15 @@ static int qc_send(struct qcc *qcc)
                goto retry;
 
  out:
+       /* Deallocate frames that the transport layer has rejected. */
+       if (!LIST_ISEMPTY(&frms)) {
+               struct quic_frame *frm, *frm2;
+               list_for_each_entry_safe(frm, frm2, &frms, list) {
+                       LIST_DELETE(&frm->list);
+                       pool_free(pool_head_quic_frame, frm);
+               }
+       }
+
        TRACE_LEAVE(QMUX_EV_QCC_SEND);
 
        return total;