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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005092120.049LKmuK027246%40masaka.moolenaar.net.

Raspunde prin e-mail lui