From 074c27d86200ba943ebb1536782865cd8e4196c4 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Thu, 12 Jul 2018 11:26:48 +0100 Subject: [PATCH] fix leaks on exit --- history.c | 3 ++- init.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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; -- 2.40.0