Patch 8.2.1160
Problem: Vim9: memory leak in allocated types.
Solution: Free the type pointers.
Files: src/vim9script.c, src/userfunc.c, src/vim9compile.c,
src/proto/
vim9compile.pro
*** ../vim-8.2.1159/src/vim9script.c 2020-07-06 21:53:14.472719363 +0200
--- src/vim9script.c 2020-07-08 19:28:42.344854028 +0200
***************
*** 126,132 ****
}
ga_clear(&si->sn_imports);
ga_clear(&si->sn_var_vals);
! ga_clear(&si->sn_type_list);
}
/*
--- 126,132 ----
}
ga_clear(&si->sn_imports);
ga_clear(&si->sn_var_vals);
! clear_type_list(&si->sn_type_list);
}
/*
*** ../vim-8.2.1159/src/userfunc.c 2020-07-01 17:28:30.339443259 +0200
--- src/userfunc.c 2020-07-08 19:30:26.084547746 +0200
***************
*** 1069,1078 ****
VIM_CLEAR(fp->uf_arg_types);
VIM_CLEAR(fp->uf_def_arg_idx);
VIM_CLEAR(fp->uf_va_name);
! while (fp->uf_type_list.ga_len > 0)
! vim_free(((type_T **)fp->uf_type_list.ga_data)
! [--fp->uf_type_list.ga_len]);
! ga_clear(&fp->uf_type_list);
#ifdef FEAT_LUA
if (fp->uf_cb_free != NULL)
--- 1069,1075 ----
VIM_CLEAR(fp->uf_arg_types);
VIM_CLEAR(fp->uf_def_arg_idx);
VIM_CLEAR(fp->uf_va_name);
! clear_type_list(&fp->uf_type_list);
#ifdef FEAT_LUA
if (fp->uf_cb_free != NULL)
*** ../vim-8.2.1159/src/vim9compile.c 2020-07-08 18:38:05.649287913 +0200
--- src/vim9compile.c 2020-07-08 19:30:30.648534269 +0200
***************
*** 321,326 ****
--- 321,334 ----
return type;
}
+ void
+ clear_type_list(garray_T *gap)
+ {
+ while (gap->ga_len > 0)
+ vim_free(((type_T **)gap->ga_data)[--gap->ga_len]);
+ ga_clear(gap);
+ }
+
static type_T *
get_list_type(type_T *member_type, garray_T *type_gap)
{
*** ../vim-8.2.1159/src/proto/
vim9compile.pro 2020-07-08 17:36:17.738105000 +0200
--- src/proto/
vim9compile.pro 2020-07-08 19:30:57.116456097 +0200
***************
*** 1,5 ****
--- 1,6 ----
/* vim9compile.c */
int check_defined(char_u *p, size_t len, cctx_T *cctx);
+ void clear_type_list(garray_T *gap);
type_T *typval2type(typval_T *tv);
int check_type(type_T *expected, type_T *actual, int give_msg);
char_u *skip_type(char_u *start);
*** ../vim-8.2.1159/src/version.c 2020-07-08 18:38:05.649287913 +0200
--- src/version.c 2020-07-08 19:34:10.347885533 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1160,
/**/
--
No engineer can take a shower without wondering if some sort of Teflon coating
would make showering unnecessary.
(Scott Adams - The Dilbert principle)
/// 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 ///