From: Timo Sirainen Date: Thu, 30 Mar 2017 22:02:49 +0000 (+0300) Subject: imap: Fix assert-crash when hibernation triggers during IDLE syncing X-Git-Tag: 2.2.29.rc1~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0545e6b8c0d5864b3473f0636f977b954934b496;p=thirdparty%2Fdovecot%2Fcore.git imap: Fix assert-crash when hibernation triggers during IDLE syncing Fixes: Panic: file cmd-idle.c: line 182 (idle_hibernate_timeout): assertion failed: (ctx->sync_ctx == NULL) --- diff --git a/src/imap/cmd-idle.c b/src/imap/cmd-idle.c index 8e3ae64319..330222878f 100644 --- a/src/imap/cmd-idle.c +++ b/src/imap/cmd-idle.c @@ -140,6 +140,12 @@ static bool idle_sync_now(struct mailbox *box, struct cmd_idle_context *ctx) { i_assert(ctx->sync_ctx == NULL); + if (ctx->to_hibernate != NULL) { + /* hibernation can't happen while sync is running. + the timeout is added back afterwards. */ + timeout_remove(&ctx->to_hibernate); + } + ctx->sync_pending = FALSE; ctx->sync_ctx = imap_sync_init(ctx->client, box, 0, 0); return cmd_idle_continue(ctx->cmd);