]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Fixed crashing with pop3_lock_session=yes
authorTimo Sirainen <tss@iki.fi>
Sun, 14 Aug 2011 21:30:18 +0000 (00:30 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 14 Aug 2011 21:30:18 +0000 (00:30 +0300)
src/lib-storage/index/mbox/mbox-lock.c

index 8a2b1aebd20749071a9cbceb7404734d07e597ed..5b15413df7d87a68ebdbf8bcb900f34380498103 100644 (file)
@@ -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);