patch 8.0.0728: the terminal structure is never freed
Problem: The terminal structure is never freed.
Solution: Free the structure and unreference what it contains.
diff --git a/src/buffer.c b/src/buffer.c
index e8e1a6d..dbd4d3a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -859,6 +859,9 @@
#ifdef FEAT_JOB_CHANNEL
channel_buffer_free(buf);
#endif
+#ifdef FEAT_TERMINAL
+ free_terminal(buf->b_term);
+#endif
buf_hashtab_remove(buf);
@@ -1771,7 +1774,7 @@
#endif
#ifdef FEAT_SYN_HL
- curwin->w_s = &(buf->b_s);
+ curwin->w_s = &(curbuf->b_s);
#endif
/* Cursor on first line by default. */