mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 16:28:17 +00:00
vim-patch:8.2.3822: leaking memory in map() and filter(), no string in Vim9
Problem: Leaking memory in map() and filter(), cannot use a string argument
in Vim9 script.
Solution: Fix the leak, adjust the argument check, also run the tests as
Vim9 script. (Yegappan Lakshmanan, closes vim/vim#9354)
2d877599ee
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -5042,7 +5042,7 @@ static void filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap
|
||||
: N_("filter() argument")));
|
||||
|
||||
// map() and filter() return the first argument, also on failure.
|
||||
if (filtermap != FILTERMAP_MAPNEW) {
|
||||
if (filtermap != FILTERMAP_MAPNEW && argvars[0].v_type != VAR_STRING) {
|
||||
tv_copy(&argvars[0], rettv);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user