From: Richard Russon Date: Wed, 4 Apr 2018 11:14:56 +0000 (+0100) Subject: history: free resources X-Git-Tag: neomutt-20180512~56^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9894fca11f42fc24eec639fe37691947ba6a4f6;p=neomutt history: free resources --- diff --git a/history.c b/history.c index 880ad8de8..7abd2de2b 100644 --- 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 * diff --git a/history.h b/history.h index 0928e35da..aa18a63c0 100644 --- 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);