From faef577e90cf17699bd7bc206b0fb64af65334d2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 17 Aug 2023 12:59:16 +0800 Subject: 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) https://github.com/vim/vim/commit/2d877599ee1cede063ef4abe3a2272e67c116238 Co-authored-by: Bram Moolenaar --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 4e3638b93f..50f5fa578c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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); } -- cgit