]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: istream-header-filter - Fix memory leak
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Oct 2025 07:40:19 +0000 (10:40 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 21 Oct 2025 08:16:07 +0000 (08:16 +0000)
Broken by 1f383819329d7637dc2f4a91b264af24a15f0256

src/lib-mail/istream-header-filter.c

index 85130c4c36ef17ed9118f4738466ad82b2fb09a8..565a463691c0c891fec2ae491de1c6a3fac948d4 100644 (file)
@@ -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);
 }