]> granicus.if.org Git - neomutt/commitdiff
fix leaks on exit
authorRichard Russon <rich@flatcap.org>
Thu, 12 Jul 2018 10:26:48 +0000 (11:26 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 16 Jul 2018 22:38:22 +0000 (23:38 +0100)
history.c
init.c

index ede1fb90ccf2cd36f05d22f1049dfeef537646e8..09210638e3d0b19ee7254a3c3fad87b04adf919f 100644 (file)
--- 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 f56f3f30855088bd731a8a96b4bbf2bd4cf38789..9bcb72d4b3443045c039db454eb4b4bed9bf7c92 100644 (file)
--- 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;