diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-11-10 11:43:56 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-11-10 11:43:56 +0100 |
commit | c56936e2ba4fd219f56aab616fcb283132455697 (patch) | |
tree | 3cd2ce6704c282b64d95f29f9e17b936fde2a080 /src/list.c | |
parent | f883508e36c209d60388b944e04e22a3fcf603cf (diff) | |
download | vim-git-c56936e2ba4fd219f56aab616fcb283132455697.tar.gz |
patch 8.2.1971: memory leak when map() failsv8.2.1971
Problem: Memory leak when map() fails.
Solution: Clear the typval.
Diffstat (limited to 'src/list.c')
-rw-r--r-- | src/list.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/list.c b/src/list.c index 866de1871..b62c14164 100644 --- a/src/list.c +++ b/src/list.c @@ -2185,8 +2185,13 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap) nli = li->li_next; set_vim_var_nr(VV_KEY, idx); if (filter_map_one(&li->li_tv, expr, filtermap, - &newtv, &rem) == FAIL || did_emsg) + &newtv, &rem) == FAIL) break; + if (did_emsg) + { + clear_tv(&newtv); + break; + } if (filtermap == FILTERMAP_MAP) { // map(): replace the list item value |