Commit Diff


commit - 91091d0c07baa6a064e8aff36e57139b397cf82a
commit + bf935370ba5b03432f48ab4d05d6dc74416a85a6
blob - 04488d125831333010987d9ada582bdd7f56f50c
blob + aa85f2b8235d29cfc9d1d75ef6a0706caf954e34
--- hist.c
+++ hist.c
@@ -21,6 +21,18 @@
 #include "telescope.h"
 
 void
+hist_clear(struct histhead *head)
+{
+	struct hist *h, *th;
+
+	TAILQ_FOREACH_SAFE(h, &head->head, entries, th) {
+		TAILQ_REMOVE(&head->head, h, entries);
+		free(h);
+	}
+	head->len = 0;
+}
+
+void
 hist_clear_forward(struct histhead *head, struct hist *h)
 {
 	if (h == NULL)
blob - 41ca7dcb1df7409e3b89e2e685af4c7d26be107a
blob + 63ef6e12486bc0fd8b6fa150d5217d871bff3b25
--- session.c
+++ session.c
@@ -143,8 +143,8 @@ unkill_tab(void)
 void
 free_tab(struct tab *tab)
 {
-	/* TODO: free the history */
 	TAILQ_REMOVE(&ktabshead, tab, tabs);
+	hist_clear(&tab->hist);
 	free(tab);
 }
 
blob - 927d3cb37b29dd04e0d0c3970be303617229a575
blob + 5a691de924eaac11c372a99c1368ecac2521497c
--- telescope.h
+++ telescope.h
@@ -296,6 +296,7 @@ struct download	*download_by_id(uint32_t);
 void		 recompute_help(void);
 
 /* hist.c */
+void		 hist_clear(struct histhead *);
 void		 hist_clear_forward(struct histhead*, struct hist*);
 void		 hist_push(struct histhead*, struct hist*);
 void		 hist_add_before(struct histhead *, struct hist *, struct hist *);