From 7a0bd4a7535eba5a6c7893803091a7d6e07cc15d Mon Sep 17 00:00:00 2001
From: Kevin McCarthy <kevin@8t8.us>
Date: Thu, 7 Jan 2021 10:43:55 +0800
Subject: [PATCH] Ensure IMAP connection is closed after a connection error.

---
 imap/imap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/imap/imap.c b/imap/imap.c
index 0c3b79d..5256035 100644
--- a/imap/imap.c
+++ b/imap/imap.c
@@ -508,9 +508,9 @@ int imap_open_connection (IMAP_DATA* idata)
 
 #if defined(USE_SSL)
  err_close_conn:
-  imap_close_connection (idata);
 #endif
  bail:
+  imap_close_connection (idata);
   FREE (&idata->capstr);
   return -1;
 }
-- 
2.23.0

