]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir: Don't crash with zlib plugin when saving is aborted
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 3 Dec 2018 13:43:06 +0000 (15:43 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 6 Feb 2019 08:09:30 +0000 (10:09 +0200)
The ostream can be finished even if the saving had already failed. It gets
deleted anyway.

Fixes:
Panic: file ostream-zlib.c: line 37 (o_stream_zlib_close): assertion failed: (zstream->ostream.finished || zstream->ostream.ostream.stream_errno != 0 || zstream->ostream.error_handling_disabled)

src/lib-storage/index/maildir/maildir-save.c

index 718ac39bbd74d46da097410691b7d3f89ae8e833..e4e98c30dcda996868866f06ef04b56eb4ffb8c7 100644 (file)
@@ -510,7 +510,7 @@ static int maildir_save_finish_real(struct mail_save_context *_ctx)
        }
 
        path = t_strconcat(ctx->tmpdir, "/", ctx->file_last->tmp_name, NULL);
-       if (!ctx->failed && o_stream_finish(_ctx->data.output) < 0) {
+       if (o_stream_finish(_ctx->data.output) < 0) {
                if (!mail_storage_set_error_from_errno(storage)) {
                        mail_set_critical(_ctx->dest_mail,
                                "write(%s) failed: %s", path,