]> granicus.if.org Git - neomutt/commitdiff
Fix segfault in new mboxcache hcache check when create is 0
authorBrendan Cully <brendan@kublai.com>
Mon, 2 Apr 2007 18:00:22 +0000 (11:00 -0700)
committerBrendan Cully <brendan@kublai.com>
Mon, 2 Apr 2007 18:00:22 +0000 (11:00 -0700)
ChangeLog
imap/imap.c

index 305e569fc8a1be93f03c1efdcde6e02f9c5be7e3..82ba9079f4b3ca78a3958a8c41d17d2b508e823d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2007-04-02 10:02 -0700  Brendan Cully  <brendan@kublai.com>  (becbad651ecc)
+2007-04-02 10:48 -0700  Brendan Cully  <brendan@kublai.com>  (aa6f191cfa10)
+
+       * imap/command.c, imap/imap.c, imap/imap_private.h, imap/message.c:
+       Add create flag to imap_mboxcache_get
+
+       * imap/command.c, imap/imap.c: Push mbox cache header cache check
+       into imap_mboxcache_get
 
        * imap/imap.c: Cache IMAP access checks
 
index 34f292a9e4d034d88e399b753d2235af9b5ba4a2..25bf0472f86155db5b09a22279a93edb0cbf9ccd 100644 (file)
@@ -1616,8 +1616,15 @@ IMAP_STATUS* imap_mboxcache_get (IMAP_DATA* idata, const char* mbox, int create)
   {
     uidvalidity = mutt_hcache_fetch_raw (hc, "/UIDVALIDITY", imap_hcache_keylen);
     uidnext = mutt_hcache_fetch_raw (hc, "/UIDNEXT", imap_hcache_keylen);
+    mutt_hcache_close (hc);
     if (uidvalidity)
     {
+      if (!status)
+      {
+        FREE (&uidvalidity);
+        FREE (&uidnext);
+        return imap_mboxcache_get (idata, mbox, 1);
+      }
       status->uidvalidity = *uidvalidity;
       status->uidnext = uidnext ? *uidnext: 0;
       dprint (3, (debugfile, "mboxcache: hcache uidvalidity %d, uidnext %d\n",
@@ -1625,7 +1632,6 @@ IMAP_STATUS* imap_mboxcache_get (IMAP_DATA* idata, const char* mbox, int create)
     }
     FREE (&uidvalidity);
     FREE (&uidnext);
-    mutt_hcache_close (hc);
   }
 #endif