]> granicus.if.org Git - neomutt/commitdiff
history: free resources
authorRichard Russon <rich@flatcap.org>
Wed, 4 Apr 2018 11:14:56 +0000 (12:14 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 4 Apr 2018 11:14:56 +0000 (12:14 +0100)
history.c
history.h

index 880ad8de815a582f70992704e522113fbaa20c5c..7abd2de2badd900625389805f0894edd226983c1 100644 (file)
--- a/history.c
+++ b/history.c
@@ -533,6 +533,22 @@ static int search_history(char *search_buf, enum HistoryClass hclass, char **mat
   return match_count;
 }
 
+/**
+ * mutt_hist_free - Free all the history lists
+ */
+void mutt_hist_free(void)
+{
+  for (enum HistoryClass hclass = HC_FIRST; hclass < HC_LAST; hclass++)
+  {
+    struct History *h = &Histories[hclass];
+    for (int i = 0; i < History; i++)
+    {
+      FREE(&h->hist[i]);
+    }
+    FREE(&Histories[hclass]);
+  }
+}
+
 /**
  * mutt_hist_init - Create a set of empty History ring buffers
  *
index 0928e35da6c6c3757d6c4c5e30b3863648133b17..aa18a63c0b5d5a9e6763173cd9730b8c01228cd9 100644 (file)
--- a/history.h
+++ b/history.h
@@ -48,6 +48,7 @@ enum HistoryClass
 
 void  mutt_hist_add(enum HistoryClass hclass, const char *str, bool save);
 bool  mutt_hist_at_scratch(enum HistoryClass hclass);
+void  mutt_hist_free(void);
 void  mutt_hist_init(void);
 char *mutt_hist_next(enum HistoryClass hclass);
 char *mutt_hist_prev(enum HistoryClass hclass);