1
0
forked from aniani/vim

patch 8.2.2505: Vim9: crash after defining function with invalid return type

Problem:    Vim9: crash after defining function with invalid return type.
Solution:   Clear function growarrays.  Fix memory leak.
This commit is contained in:
Bram Moolenaar
2021-02-12 22:10:21 +01:00
parent 44ec21c467
commit 31842cd077
3 changed files with 24 additions and 0 deletions

View File

@@ -3955,8 +3955,15 @@ define_function(exarg_T *eap, char_u *name_arg)
erret:
ga_clear_strings(&newargs);
ga_clear_strings(&default_args);
if (fp != NULL)
{
ga_init(&fp->uf_args);
ga_init(&fp->uf_def_args);
}
errret_2:
ga_clear_strings(&newlines);
if (fp != NULL)
VIM_CLEAR(fp->uf_arg_types);
ret_free:
ga_clear_strings(&argtypes);
vim_free(skip_until);