From: Justin Tobler Date: Mon, 04 Nov 2024 22:31:34 GMT Subject: Re: [PATCH v2 11/22] trailer: fix leaking strbufs when formatting trailers Message-ID: In-Reply-To: <5b851453bcea945f95c3f29138e510d8448e96e6.1729502824.git.ps@pks.im> On 24/10/21 11:28AM, Patrick Steinhardt wrote: > We are populating, but never releasing two string buffers in > `format_trailers()`, causing a memory leak. Plug this leak by lifting > those buffers outside of the loop and releasing them on function return. > This fixes the memory leaks, but also optimizes the loop as we don't > have to reallocate the buffers on every single iteration. I see that we were previously calling `strbuf_release()` inside of the loop. In practice were these never hit? Or just sometimes skipped my the "continue" in the loop? The commit message makes it sound like the former.