]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Crashfix on some failed save error conditions.
authorTimo Sirainen <tss@iki.fi>
Mon, 4 Mar 2013 13:53:42 +0000 (15:53 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 4 Mar 2013 13:53:42 +0000 (15:53 +0200)
src/lib-storage/index/dbox-common/dbox-save.c

index 35aebf390f7e98305d4479d4631a472601656b3f..b85c4f0c28ac13230b466adbeae8bb837388e236 100644 (file)
@@ -106,10 +106,14 @@ void dbox_save_end(struct dbox_save_context *ctx)
                        ctx->failed = TRUE;
        }
        if (ctx->ctx.output != dbox_output) {
-               /* e.g. zlib plugin had changed this */
-               o_stream_ref(dbox_output);
-               o_stream_destroy(&ctx->ctx.output);
-               ctx->ctx.output = dbox_output;
+               if (ctx->ctx.output != NULL) {
+                       /* e.g. zlib plugin had changed this */
+                       o_stream_ref(dbox_output);
+                       o_stream_destroy(&ctx->ctx.output);
+                       ctx->ctx.output = dbox_output;
+               } else {
+                       i_assert(ctx->failed);
+               }
        }
        index_mail_cache_parse_deinit(ctx->ctx.dest_mail,
                                      ctx->ctx.received_date, !ctx->failed);