Mercurial > vim
changeset 10561:e025378406d1 v8.0.0170
patch 8.0.0170: crash in channel test
commit https://github.com/vim/vim/commit/e32abbe42c921c5e521420417abe5bc301e540b3
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 10 22:57:34 2017 +0100
patch 8.0.0170: crash in channel test
Problem: Channel test fails for using freed memory.
Solution: Fix memory use in json_decode().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 10 Jan 2017 23:00:05 +0100 |
parents | 1c09563f6fa4 |
children | 9b1ca542ca91 |
files | src/json.c src/version.c |
diffstat | 2 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/json.c +++ b/src/json.c @@ -577,6 +577,8 @@ json_decode_item(js_read_T *reader, typv 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; }