From: Timo Sirainen Date: Mon, 20 Oct 2025 07:40:19 +0000 (+0300) Subject: lib-mail: istream-header-filter - Fix memory leak X-Git-Tag: 2.4.2~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d0aa23e792a722b84ae8430344ebb57037d4f4b5;p=thirdparty%2Fdovecot%2Fcore.git lib-mail: istream-header-filter - Fix memory leak Broken by 1f383819329d7637dc2f4a91b264af24a15f0256 --- diff --git a/src/lib-mail/istream-header-filter.c b/src/lib-mail/istream-header-filter.c index 85130c4c36..565a463691 100644 --- a/src/lib-mail/istream-header-filter.c +++ b/src/lib-mail/istream-header-filter.c @@ -677,12 +677,11 @@ i_stream_header_filter_snapshot_free(struct istream_snapshot *_snapshot) struct header_filter_istream_snapshot *snapshot = container_of(_snapshot, struct header_filter_istream_snapshot, snapshot); - if (snapshot->mstream->hdr_buf != snapshot->hdr_buf) - ref_buffer_unref(&snapshot->hdr_buf); - else { + if (snapshot->mstream->hdr_buf == snapshot->hdr_buf) { i_assert(snapshot->mstream->snapshot_pending_refcount > 0); snapshot->mstream->snapshot_pending_refcount--; } + ref_buffer_unref(&snapshot->hdr_buf); i_free(snapshot); }