aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-17 12:59:16 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-08-17 13:14:32 +0800
commitfaef577e90cf17699bd7bc206b0fb64af65334d2 (patch)
treeb10eccc94a3ae24569c4757b2f7c3dbe5426bb28 /src/nvim/eval.c
parentd9e7dad13945ce1f4110c37d5388b5c532dec0d3 (diff)
downloadrneovim-faef577e90cf17699bd7bc206b0fb64af65334d2.tar.gz
rneovim-faef577e90cf17699bd7bc206b0fb64af65334d2.tar.bz2
rneovim-faef577e90cf17699bd7bc206b0fb64af65334d2.zip
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 <Bram@vim.org>
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c2
1 files changed, 1 insertions, 1 deletions
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);
}