]> granicus.if.org Git - vim/commitdiff
patch 8.0.0170: crash in channel test v8.0.0170
authorBram Moolenaar <Bram@vim.org>
Tue, 10 Jan 2017 21:57:34 +0000 (22:57 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 10 Jan 2017 21:57:34 +0000 (22:57 +0100)
Problem:    Channel test fails for using freed memory.
Solution:   Fix memory use in json_decode().

src/json.c
src/version.c

index 091d98f5926f9c1c8c75dac6a948a187dac8f2ec..2cc3a2a3946fbd551b54c6d5419ed2087157c330 100644 (file)
@@ -577,6 +577,8 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
     ga_init2(&stack, sizeof(json_dec_item_T), 100);
     cur_item = res;
     init_tv(&item);
+    if (res != NULL)
+    init_tv(res);
 
     fill_numbuflen(reader);
     p = reader->js_buf + reader->js_used;
@@ -985,7 +987,6 @@ item_end:
 
 theend:
     ga_clear(&stack);
-    clear_tv(&item);
     return retval;
 }
 
index 23dd5aeb6dbd20f3c0f751bb0690c87d53f4d643..4bc287fccaa7530d5419ee939935f4d6c5b63ae9 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    170,
 /**/
     169,
 /**/