Patch 8.2.2505
Problem: Vim9: crash after defining function with invalid return type.
Solution: Clear function growarrays. Fix memory leak.
Files: src/userfunc.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.2504/src/userfunc.c 2021-02-07 18:06:25.266692335 +0100
--- src/userfunc.c 2021-02-12 22:06:31.955386993 +0100
***************
*** 3955,3962 ****
--- 3955,3969 ----
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);
*** ../vim-8.2.2504/src/testdir/test_vim9_func.vim 2021-02-12
21:50:53.509801284 +0100
--- src/testdir/test_vim9_func.vim 2021-02-12 22:09:19.347353170 +0100
***************
*** 254,259 ****
--- 254,274 ----
defcompile
END
CheckScriptFailure(lines, 'E1010:', 2)
+
+ lines =<< trim END
+ vim9script
+ def Test(Fun: func(number): number): list<number>
+ return map([1, 2, 3], (_, i) => Fun(i))
+ enddef
+ defcompile
+ def Inc(nr: number): nr
+ return nr + 2
+ enddef
+ echo Test(Inc)
+ END
+ # doing this twice was leaking memory
+ CheckScriptFailure(lines, 'E1010:')
+ CheckScriptFailure(lines, 'E1010:')
enddef
func Increment()
*** ../vim-8.2.2504/src/version.c 2021-02-12 21:50:53.509801284 +0100
--- src/version.c 2021-02-12 22:09:48.363334268 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2505,
/**/
--
Windows
M!uqoms
/// 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/202102122111.11CLBqwC968947%40masaka.moolenaar.net.