From: Timo Sirainen Date: Sun, 14 Aug 2011 21:30:18 +0000 (+0300) Subject: mbox: Fixed crashing with pop3_lock_session=yes X-Git-Tag: 2.1.alpha1~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fe2f0c34044aad9f6cc1e23dfc696dc464348cb;p=thirdparty%2Fdovecot%2Fcore.git mbox: Fixed crashing with pop3_lock_session=yes --- diff --git a/src/lib-storage/index/mbox/mbox-lock.c b/src/lib-storage/index/mbox/mbox-lock.c index 8a2b1aebd2..5b15413df7 100644 --- a/src/lib-storage/index/mbox/mbox-lock.c +++ b/src/lib-storage/index/mbox/mbox-lock.c @@ -784,8 +784,10 @@ int mbox_lock(struct mbox_mailbox *mbox, int lock_type, i_assert(lock_type == F_RDLCK || lock_type == F_WRLCK); i_assert(lock_type == F_RDLCK || mbox->mbox_lock_type != F_RDLCK); - /* mbox must be locked before index */ - i_assert(mbox->box.index->lock_type != F_WRLCK); + /* mbox must be locked before index (the NULL check is for + MAILBOX_FLAG_KEEP_LOCKED) */ + i_assert(mbox->box.index == NULL || + mbox->box.index->lock_type != F_WRLCK); if (mbox->mbox_lock_type == F_UNLCK) { ret = mbox_update_locking(mbox, lock_type, &fcntl_locked);