diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-01-10 22:57:34 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-01-10 22:57:34 +0100 |
commit | e32abbe42c921c5e521420417abe5bc301e540b3 (patch) | |
tree | a5e4989dc999354c2e221878c23396aa4da01d3c /src/json.c | |
parent | 8b2f19536ff979046f0d241850f4176a1ce4bca9 (diff) |
patch 8.0.0170: crash in channel testv8.0.0170
Problem: Channel test fails for using freed memory.
Solution: Fix memory use in json_decode().
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c index 091d98f592..2cc3a2a394 100644 --- a/src/json.c +++ b/src/json.c @@ -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; } |