From b6ca9b2bc390eeba8a6fcd096670aff2f1e1b758 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Mon, 22 May 2017 18:30:38 -0700 Subject: [PATCH] Don't clean up msn idata when closing an open-append mailbox. (see #3942) This is a continuation of commit 59a2125b49f2 with changes made in the default branch. Thanks again to Will Yardley for helping test the imap read-headers changes and discovering this bug. --- imap/imap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imap/imap.c b/imap/imap.c index 67b2c4ce3..a3b9e1e52 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1409,6 +1409,9 @@ int imap_close_mailbox (CONTEXT* ctx) idata->ctx = NULL; hash_destroy (&idata->uid_hash, NULL); + FREE (&idata->msn_index); + idata->msn_index_size = 0; + idata->max_msn = 0; for (i = 0; i < IMAP_CACHE_LEN; i++) { @@ -1427,8 +1430,6 @@ int imap_close_mailbox (CONTEXT* ctx) /* mailbox may not have fully loaded */ if (ctx->hdrs[i] && ctx->hdrs[i]->data) imap_free_header_data ((IMAP_HEADER_DATA**)&(ctx->hdrs[i]->data)); - FREE (&idata->msn_index); - idata->msn_index_size = 0; return 0; } -- 2.40.0