]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
SELECT: If closing old mailbox gives an error, don't crash.
authorTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2008 20:34:02 +0000 (23:34 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2008 20:34:02 +0000 (23:34 +0300)
--HG--
branch : HEAD

src/imap/cmd-select.c

index bdfa87c66b9e54aafcb15f987f4405d11603debc..1e912f586c6cbc7746920f5c651cc479a23aae38 100644 (file)
@@ -359,14 +359,15 @@ bool cmd_select_full(struct client_command_context *cmd, bool readonly)
        client->mailbox_change_lock = cmd;
 
        if (client->mailbox != NULL) {
+               struct mail_storage *old_storage =
+                       mailbox_get_storage(client->mailbox);
+
                client_search_updates_free(client);
                box = client->mailbox;
                client->mailbox = NULL;
 
-               if (mailbox_close(&box) < 0) {
-                       client_send_untagged_storage_error(client,
-                               mailbox_get_storage(box));
-               }
+               if (mailbox_close(&box) < 0)
+                       client_send_untagged_storage_error(client, old_storage);
                /* CLOSED response is required by QRESYNC */
                client_send_line(client, "* OK [CLOSED]");
        }