From d0aa23e792a722b84ae8430344ebb57037d4f4b5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 20 Oct 2025 10:40:19 +0300 Subject: [PATCH] lib-mail: istream-header-filter - Fix memory leak Broken by 1f383819329d7637dc2f4a91b264af24a15f0256 --- src/lib-mail/istream-header-filter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); } -- 2.47.3