comparison src/json.c @ 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 4d8be28b5913
children bac9cec298ed
comparison
equal deleted inserted replaced
10560:1c09563f6fa4 10561:e025378406d1
575 char_u key_buf[NUMBUFLEN]; 575 char_u key_buf[NUMBUFLEN];
576 576
577 ga_init2(&stack, sizeof(json_dec_item_T), 100); 577 ga_init2(&stack, sizeof(json_dec_item_T), 100);
578 cur_item = res; 578 cur_item = res;
579 init_tv(&item); 579 init_tv(&item);
580 if (res != NULL)
581 init_tv(res);
580 582
581 fill_numbuflen(reader); 583 fill_numbuflen(reader);
582 p = reader->js_buf + reader->js_used; 584 p = reader->js_buf + reader->js_used;
583 for (;;) 585 for (;;)
584 { 586 {
983 } 985 }
984 EMSG(_(e_invarg)); 986 EMSG(_(e_invarg));
985 987
986 theend: 988 theend:
987 ga_clear(&stack); 989 ga_clear(&stack);
988 clear_tv(&item);
989 return retval; 990 return retval;
990 } 991 }
991 992
992 /* 993 /*
993 * Decode the JSON from "reader" and store the result in "res". 994 * Decode the JSON from "reader" and store the result in "res".