Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7899:11727b49373e HEAD
mbox: Don't crash if saving is aborted early.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 19 Jun 2008 08:13:36 +0300 |
parents | 29d6c17f2009 |
children | 40863bb70e3c |
files | src/lib-storage/index/mbox/mbox-save.c |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c Wed Jun 18 12:09:48 2008 +0300 +++ b/src/lib-storage/index/mbox/mbox-save.c Thu Jun 19 08:13:36 2008 +0300 @@ -654,9 +654,11 @@ { 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) {