Patch 8.2.0726

12 views
Skip to first unread message

Bram Moolenaar

unread,
May 9, 2020, 5:20:57 PM5/9/20
to vim...@googlegroups.com

Patch 8.2.0726
Problem: Vim9: leaking memory when calling not compiled :def function.
Solution: Check if function is compiled earlier.
Files: src/vim9execute.c


*** ../vim-8.2.0725/src/vim9execute.c 2020-05-09 22:50:04.755323771 +0200
--- src/vim9execute.c 2020-05-09 23:19:02.153569561 +0200
***************
*** 665,674 ****
// Like STACK_TV_VAR but use the outer scope
#define STACK_OUT_TV_VAR(idx) (((typval_T *)ectx.ec_outer_stack->ga_data) + ectx.ec_outer_frame + STACK_FRAME_SIZE + idx)

- CLEAR_FIELD(ectx);
- ga_init2(&ectx.ec_stack, sizeof(typval_T), 500);
- if (ga_grow(&ectx.ec_stack, 20) == FAIL)
- return FAIL;
{
// Check the function was compiled, it is postponed in ex_vim9script().
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
--- 665,670 ----
***************
*** 676,683 ****
if (dfunc->df_instr == NULL)
return FAIL;
}
- ectx.ec_dfunc_idx = ufunc->uf_dfunc_idx;

ga_init2(&ectx.ec_trystack, sizeof(trycmd_T), 10);

// Put arguments on the stack.
--- 672,683 ----
if (dfunc->df_instr == NULL)
return FAIL;
}

+ CLEAR_FIELD(ectx);
+ ectx.ec_dfunc_idx = ufunc->uf_dfunc_idx;
+ ga_init2(&ectx.ec_stack, sizeof(typval_T), 500);
+ if (ga_grow(&ectx.ec_stack, 20) == FAIL)
+ return FAIL;
ga_init2(&ectx.ec_trystack, sizeof(trycmd_T), 10);

// Put arguments on the stack.
*** ../vim-8.2.0725/src/version.c 2020-05-09 22:50:04.755323771 +0200
--- src/version.c 2020-05-09 23:20:07.101344125 +0200
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 726,
/**/

--
hundred-and-one symptoms of being an internet addict:
85. Choice between paying Compuserve bill and paying for kids education
is a no brainer -- although a bit painful for your kids.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages