From: Brendan Cully Date: Mon, 2 Apr 2007 18:00:22 +0000 (-0700) Subject: Fix segfault in new mboxcache hcache check when create is 0 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d805b79d716e8b709c96c309c7e101aaf10379f;p=neomutt Fix segfault in new mboxcache hcache check when create is 0 --- diff --git a/ChangeLog b/ChangeLog index 305e569fc..82ba9079f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -2007-04-02 10:02 -0700 Brendan Cully (becbad651ecc) +2007-04-02 10:48 -0700 Brendan Cully (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 diff --git a/imap/imap.c b/imap/imap.c index 34f292a9e..25bf0472f 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -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