From: Amaury Denoyelle Date: Tue, 17 May 2022 16:53:21 +0000 (+0200) Subject: BUG/MINOR: mux-quic: support nul buffer with qc_free_ncbuf() X-Git-Tag: v2.6-dev11~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7313f5ee7e4e87c2e01dae058603f17f4bd78d4c;p=thirdparty%2Fhaproxy.git BUG/MINOR: mux-quic: support nul buffer with qc_free_ncbuf() 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. --- diff --git a/src/mux_quic.c b/src/mux_quic.c index 68b2bd8a58..6cc7756d88 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -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; }