From: Timo Sirainen Date: Mon, 4 Mar 2013 13:53:42 +0000 (+0200) Subject: dbox: Crashfix on some failed save error conditions. X-Git-Tag: 2.2.rc3~1^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcf4259a9de2a5c86cea67e5bb1321ff5222746d;p=thirdparty%2Fdovecot%2Fcore.git dbox: Crashfix on some failed save error conditions. --- diff --git a/src/lib-storage/index/dbox-common/dbox-save.c b/src/lib-storage/index/dbox-common/dbox-save.c index 35aebf390f..b85c4f0c28 100644 --- a/src/lib-storage/index/dbox-common/dbox-save.c +++ b/src/lib-storage/index/dbox-common/dbox-save.c @@ -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);