To: vim_dev@googlegroups.com Subject: Patch 7.4.2327 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2327 Problem: Freeing a variable that is on the stack. Solution: Don't free res_tv or err_tv. (Ozaki Kiichi) Files: src/channel.c *** ../vim-7.4.2326/src/channel.c 2016-09-01 15:11:13.544265437 +0200 --- src/channel.c 2016-09-04 20:40:17.984927934 +0200 *************** *** 2142,2148 **** } else { ! typval_T *tv; typval_T res_tv; typval_T err_tv; char_u *json = NULL; --- 2142,2148 ---- } else { ! typval_T *tv = NULL; typval_T res_tv; typval_T err_tv; char_u *json = NULL; *************** *** 2159,2166 **** ch_logs(channel, "Calling '%s'", (char *)arg); if (func_call(arg, &argv[2], NULL, NULL, &res_tv) == OK) tv = &res_tv; - else - tv = NULL; } if (argv[id_idx].v_type == VAR_NUMBER) --- 2159,2164 ---- *************** *** 2174,2184 **** /* If evaluation failed or the result can't be encoded * then return the string "ERROR". */ vim_free(json); - free_tv(tv); err_tv.v_type = VAR_STRING; err_tv.vval.v_string = (char_u *)"ERROR"; ! tv = &err_tv; ! json = json_encode_nr_expr(id, tv, options | JSON_NL); } if (json != NULL) { --- 2172,2180 ---- /* If evaluation failed or the result can't be encoded * then return the string "ERROR". */ vim_free(json); err_tv.v_type = VAR_STRING; err_tv.vval.v_string = (char_u *)"ERROR"; ! json = json_encode_nr_expr(id, &err_tv, options | JSON_NL); } if (json != NULL) { *************** *** 2191,2197 **** --emsg_skip; if (tv == &res_tv) clear_tv(tv); ! else if (tv != &err_tv) free_tv(tv); } } --- 2187,2193 ---- --emsg_skip; if (tv == &res_tv) clear_tv(tv); ! else free_tv(tv); } } *** ../vim-7.4.2326/src/version.c 2016-09-04 20:34:55.767537370 +0200 --- src/version.c 2016-09-04 20:41:38.216277832 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2327, /**/ -- "Hit any key to continue" does _not_ mean you can hit the on/off button! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///