forked from aniani/vim
patch 8.2.1160: Vim9: memory leak in allocated types
Problem: Vim9: memory leak in allocated types. Solution: Free the type pointers.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
/* vim9compile.c */
|
/* vim9compile.c */
|
||||||
int check_defined(char_u *p, size_t len, cctx_T *cctx);
|
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);
|
type_T *typval2type(typval_T *tv);
|
||||||
int check_type(type_T *expected, type_T *actual, int give_msg);
|
int check_type(type_T *expected, type_T *actual, int give_msg);
|
||||||
char_u *skip_type(char_u *start);
|
char_u *skip_type(char_u *start);
|
||||||
|
@@ -1069,10 +1069,7 @@ func_clear_items(ufunc_T *fp)
|
|||||||
VIM_CLEAR(fp->uf_arg_types);
|
VIM_CLEAR(fp->uf_arg_types);
|
||||||
VIM_CLEAR(fp->uf_def_arg_idx);
|
VIM_CLEAR(fp->uf_def_arg_idx);
|
||||||
VIM_CLEAR(fp->uf_va_name);
|
VIM_CLEAR(fp->uf_va_name);
|
||||||
while (fp->uf_type_list.ga_len > 0)
|
clear_type_list(&fp->uf_type_list);
|
||||||
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
|
#ifdef FEAT_LUA
|
||||||
if (fp->uf_cb_free != NULL)
|
if (fp->uf_cb_free != NULL)
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1160,
|
||||||
/**/
|
/**/
|
||||||
1159,
|
1159,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -321,6 +321,14 @@ alloc_type(garray_T *type_gap)
|
|||||||
return type;
|
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 *
|
static type_T *
|
||||||
get_list_type(type_T *member_type, garray_T *type_gap)
|
get_list_type(type_T *member_type, garray_T *type_gap)
|
||||||
{
|
{
|
||||||
|
@@ -126,7 +126,7 @@ free_imports(int sid)
|
|||||||
}
|
}
|
||||||
ga_clear(&si->sn_imports);
|
ga_clear(&si->sn_imports);
|
||||||
ga_clear(&si->sn_var_vals);
|
ga_clear(&si->sn_var_vals);
|
||||||
ga_clear(&si->sn_type_list);
|
clear_type_list(&si->sn_type_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user