diff src/channel.c @ 7931:2679e636e862 v7.4.1261

commit https://github.com/vim/vim/commit/4b6a6dcbe7bd13170c4884cc17acb1eac2c633d1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 4 22:49:49 2016 +0100 patch 7.4.1261 Problem: Pending channel messages are garbage collected. Leaking memory in ch_sendexpr(). Leaking memory for a decoded JSON string. Solution: Mark the message list as used. Free the encoded JSON. Don't save the JSON string.
author Christian Brabandt <cb@256bit.org>
date Thu, 04 Feb 2016 23:00:06 +0100
parents e44240b5a6da
children 1f0743f4f88f
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -1315,4 +1315,29 @@ channel_parse_messages(void)
     return ret;
 }
 
+    int
+set_ref_in_channel(int copyID)
+{
+    int	    i;
+    int	    abort = FALSE;
+
+    for (i = 0; i < channel_count; ++i)
+    {
+	jsonq_T *head = &channels[i].ch_json_head;
+	jsonq_T *item = head->next;
+
+	while (item != head)
+	{
+	    list_T	*l = item->value->vval.v_list;
+
+	    if (l->lv_copyID != copyID)
+	    {
+		l->lv_copyID = copyID;
+		abort = abort || set_ref_in_list(l, copyID, NULL);
+	    }
+	    item = item->next;
+	}
+    }
+    return abort;
+}
 #endif /* FEAT_CHANNEL */