Mercurial > vim
diff src/userfunc.c @ 23925:e979bf909fd8 v8.2.2505
patch 8.2.2505: Vim9: crash after defining function with invalid return type
Commit: https://github.com/vim/vim/commit/31842cd0772b557eb9584a13740430db29de8a51
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 12 22:10:21 2021 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 12 Feb 2021 22:15:03 +0100 |
parents | d95403445b6b |
children | 03819ebd3e6d |
line wrap: on
line diff
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -3955,8 +3955,15 @@ define_function(exarg_T *eap, char_u *na 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);