From 532e4c087f2a7970b47479404039f84422adb2ff Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 1 Apr 2020 17:02:03 +0300 Subject: [PATCH] lib-index: mail_cache_sync_reset_id() - Move cache unlocking to caller --- src/lib-index/mail-cache.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index 2384532fef..0e464143a2 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -670,14 +670,10 @@ static int mail_cache_sync_reset_id(struct mail_cache *cache) break; /* mismatch. try refreshing index once. if that doesn't help, we can't use the cache. */ - if (i > 0 || cache->index->mapping) { - mail_cache_unlock_file(cache); + if (i > 0 || cache->index->mapping) return 0; - } - if (mail_index_refresh(cache->index) < 0) { - mail_cache_unlock_file(cache); + if (mail_index_refresh(cache->index) < 0) return -1; - } } return 1; } @@ -718,8 +714,10 @@ mail_cache_lock_full(struct mail_cache *cache, bool nonblock) /* okay, so it was just compressed. try again. */ } - if ((ret = mail_cache_sync_reset_id(cache)) <= 0) + if ((ret = mail_cache_sync_reset_id(cache)) <= 0) { + mail_cache_unlock_file(cache); return ret; + } /* successfully locked - make sure our header is up to date */ cache->locked = TRUE; -- 2.47.3