Skip to content

Commit e32abbe

Browse files
committed
patch 8.0.0170: crash in channel test
Problem: Channel test fails for using freed memory. Solution: Fix memory use in json_decode().
1 parent 8b2f195 commit e32abbe

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/json.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,8 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
577577
ga_init2(&stack, sizeof(json_dec_item_T), 100);
578578
cur_item = res;
579579
init_tv(&item);
580+
if (res != NULL)
581+
init_tv(res);
580582

581583
fill_numbuflen(reader);
582584
p = reader->js_buf + reader->js_used;
@@ -985,7 +987,6 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
985987

986988
theend:
987989
ga_clear(&stack);
988-
clear_tv(&item);
989990
return retval;
990991
}
991992

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
170,
767769
/**/
768770
169,
769771
/**/

0 commit comments

Comments
 (0)