From: Amaury Denoyelle Date: Fri, 1 Apr 2022 14:41:21 +0000 (+0200) Subject: BUG/MINOR: fix memleak on quic-conn streams cleaning X-Git-Tag: v2.6-dev5~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9acc31018d8b8736f4c6276479e9e0e4366fb87;p=thirdparty%2Fhaproxy.git BUG/MINOR: fix memleak on quic-conn streams cleaning When freeing a quic-conn, the streams resources attached to it must be cleared. This code is already implemented but the streams buffer was not deallocated. Fix this by using the function qc_stream_desc_free. This existing function centralize all operations to properly free all streams elements, attached both to the MUX and the quic-conn. This fixes a memory leak which can happen for each released connection. --- diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 8757d9db31..65414fde0c 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -3808,8 +3808,11 @@ static void quic_conn_release(struct quic_conn *qc) stream = eb64_entry(node, struct qc_stream_desc, by_id); node = eb64_next(node); - eb64_delete(&stream->by_id); - pool_free(pool_head_quic_conn_stream, stream); + /* all streams attached to the quic-conn are released, so + * qc_stream_desc_free will liberate the stream instance. + */ + BUG_ON(!stream->release); + qc_stream_desc_free(stream); } if (qc->idle_timer_task) {