From: Richard Russon Date: Thu, 12 Jul 2018 10:26:48 +0000 (+0100) Subject: fix leaks on exit X-Git-Tag: 2019-10-25~757^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=074c27d86200ba943ebb1536782865cd8e4196c4;p=neomutt fix leaks on exit --- diff --git a/history.c b/history.c index ede1fb90c..09210638e 100644 --- a/history.c +++ b/history.c @@ -559,7 +559,8 @@ void mutt_hist_free(void) if (!h->hist) continue; - for (int i = 0; i < History; i++) + /* The array has (History+1) elements */ + for (int i = 0; i <= History; i++) { FREE(&h->hist[i]); } diff --git a/init.c b/init.c index f56f3f308..9bcb72d4b 100644 --- a/init.c +++ b/init.c @@ -1334,8 +1334,9 @@ static int source_rc(const char *rcfile_path, struct Buffer *err) if (!ispipe && !STAILQ_EMPTY(&MuttrcStack)) { struct ListNode *np = STAILQ_FIRST(&MuttrcStack); - FREE(&np->data); STAILQ_REMOVE_HEAD(&MuttrcStack, entries); + FREE(&np->data); + FREE(&np); } return rc;