]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-quic: support nul buffer with qc_free_ncbuf()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 17 May 2022 16:53:21 +0000 (18:53 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 18 May 2022 14:25:07 +0000 (16:25 +0200)
qc_free_ncbuf() may now be used with a NCBUF_NULL buffer as parameter.
This is useful when using this function on a QCS with no allocated
buffer. This case was not reproduced for the moment, but it will soon
become more present as buffers will be released if emptied.

Also a call to offer_buffers() is added to conform with the dynamic
buffer management of haproxy.

src/mux_quic.c

index 68b2bd8a587ca1190ebd78226312dce1ddb0ffa7..6cc7756d88729063175b4d7eb51f148202fcbcc8 100644 (file)
@@ -189,8 +189,12 @@ static void qc_free_ncbuf(struct qcs *qcs, struct ncbuf *ncbuf)
 {
        struct buffer buf;
 
+       if (ncb_is_null(ncbuf))
+               return;
+
        buf = b_make(ncbuf->area, ncbuf->size, 0, 0);
        b_free(&buf);
+       offer_buffers(NULL, 1);
 
        *ncbuf = NCBUF_NULL;
 }