From 08f723d8da41016dbaafccb9cfde7b33869b9cf6 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Thu, 5 Apr 2007 16:42:56 -0700 Subject: [PATCH] Small hcache-related memory leaks --- imap/message.c | 2 ++ mh.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/imap/message.c b/imap/message.c index 50cdeeff2..7a91b7f24 100644 --- a/imap/message.c +++ b/imap/message.c @@ -131,6 +131,8 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) if (uid_validity && uidnext && *uid_validity == idata->uid_validity && *uidnext > 0) evalhc = 1; + else + FREE (&uidnext); FREE (&uid_validity); } if (evalhc) diff --git a/mh.c b/mh.c index 76a79a112..b4e42c273 100644 --- a/mh.c +++ b/mh.c @@ -700,11 +700,15 @@ static int maildir_parse_entry (CONTEXT * ctx, struct maildir ***last, { #ifdef USE_HCACHE if (hc && (data = mutt_hcache_fetch (hc, fname, strlen))) + { h = mutt_hcache_restore ((unsigned char *) data, NULL); + FREE (&data); + } else { h = maildir_parse_message (ctx->magic, buf, is_old, NULL); - mutt_hcache_store (hc, fname, h, 0, strlen); + if (h) + mutt_hcache_store (hc, fname, h, 0, strlen); } #else h = maildir_parse_message (ctx->magic, buf, is_old, NULL); @@ -1035,7 +1039,7 @@ void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md, } else mutt_free_header (&p->h); #if USE_HCACHE - FREE(&data); + FREE (&data); #endif } #if USE_HCACHE -- 2.50.1