From: Timo Sirainen Date: Sun, 5 Feb 2023 18:46:34 +0000 (+0200) Subject: lib-index: Fix event leak if purging dovecot.index.cache fails X-Git-Tag: 2.3.21~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08740f79029af5de396571b82d41e0e686bba758;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Fix event leak if purging dovecot.index.cache fails --- diff --git a/src/lib-index/mail-cache-purge.c b/src/lib-index/mail-cache-purge.c index bc86bf1839..2cb11316e7 100644 --- a/src/lib-index/mail-cache-purge.c +++ b/src/lib-index/mail-cache-purge.c @@ -392,17 +392,21 @@ mail_cache_purge_write(struct mail_cache *cache, if (mail_cache_copy(cache, trans, event, fd, reason, &file_seq, &file_size, &max_uid, - &ext_first_seq, &ext_offsets) < 0) + &ext_first_seq, &ext_offsets) < 0) { + event_unref(&event); return -1; + } if (fstat(fd, &st) < 0) { mail_cache_set_syscall_error(cache, "fstat()"); array_free(&ext_offsets); + event_unref(&event); return -1; } if (rename(temp_path, cache->filepath) < 0) { mail_cache_set_syscall_error(cache, "rename()"); array_free(&ext_offsets); + event_unref(&event); return -1; }