]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Don't crash if saving is aborted early.
authorTimo Sirainen <tss@iki.fi>
Thu, 19 Jun 2008 05:13:36 +0000 (08:13 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 19 Jun 2008 05:13:36 +0000 (08:13 +0300)
--HG--
branch : HEAD

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

index 3e591e5177c8e5c1f974103de31d28084425aaa4..c1817da9c617ed3c5ff98027f8354fe153609c92 100644 (file)
@@ -654,9 +654,11 @@ int mbox_save_finish(struct mail_save_context *_ctx)
 {
        struct mbox_save_context *ctx = (struct mbox_save_context *)_ctx;
 
-       /* make sure everything is written */
-       if (o_stream_flush(ctx->output) < 0)
-               return write_error(ctx);
+       if (ctx->output != NULL) {
+               /* make sure everything is written */
+               if (o_stream_flush(ctx->output) < 0)
+                       return write_error(ctx);
+       }
 
        ctx->finished = TRUE;
        if (!ctx->failed) {