dovecot-2.2: indexer-worker: Don't crash if we failed to get mai...

dovecot at dovecot.org dovecot at dovecot.org
Sat May 9 16:33:16 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/a982d64d1727
changeset: 18611:a982d64d1727
user:      Timo Sirainen <tss at iki.fi>
date:      Sat May 09 19:28:46 2015 +0300
description:
indexer-worker: Don't crash if we failed to get mailbox path.
Found by Coverity

diffstat:

 src/indexer/master-connection.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (25 lines):

diff -r 7f151aca47ac -r a982d64d1727 src/indexer/master-connection.c
--- a/src/indexer/master-connection.c	Sat May 09 19:26:01 2015 +0300
+++ b/src/indexer/master-connection.c	Sat May 09 19:28:46 2015 +0300
@@ -139,14 +139,15 @@
 	ns = mail_namespace_find(user->namespaces, mailbox);
 	box = mailbox_alloc(ns->list, mailbox, 0);
 	ret = mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_INDEX, &path);
-	if (ret <= 0) {
+	if (ret < 0) {
+		i_error("Getting path to mailbox %s failed: %s",
+			mailbox, mailbox_get_last_error(box, NULL));
 		mailbox_free(&box);
-		if (ret < 0) {
-			i_error("Getting path to mailbox %s failed: %s",
-				mailbox, mailbox_get_last_error(box, NULL));
-			return -1;
-		}
+		return -1;
+	}
+	if (ret == 0) {
 		i_info("Indexes disabled for mailbox %s, skipping", mailbox);
+		mailbox_free(&box);
 		return 0;
 	}
 	ret = 0;


More information about the dovecot-cvs mailing list