diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-11-19 20:04:48 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-11-19 20:04:48 +0100 |
commit | b738c9a4421e6f8e799937fb18c13c7c6eb6c1a6 (patch) | |
tree | 8d3207bc1d92fdb26783c7f1209f294cf87ad7d2 /src/eval.c | |
parent | 2683c8e7f7d8eb6222653d55849a9c556de27f45 (diff) | |
download | vim-b738c9a4421e6f8e799937fb18c13c7c6eb6c1a6.zip |
updated for version 7.4.525
Problem: map() leaks memory when there is an error in the expression.
Solution: Call clear_tv(). (Christian Brabandt)
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c index c7cc0089d..840e1e8f8 100644 --- a/src/eval.c +++ b/src/eval.c @@ -10720,18 +10720,20 @@ filter_map(argvars, rettv, map) { if (!HASHITEM_EMPTY(hi)) { + int r; + --todo; di = HI2DI(hi); if (tv_check_lock(di->di_tv.v_lock, (char_u *)_(arg_errmsg))) break; vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); - if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL - || did_emsg) + r = filter_map_one(&di->di_tv, expr, map, &rem); + clear_tv(&vimvars[VV_KEY].vv_tv); + if (r == FAIL || did_emsg) break; if (!map && rem) dictitem_remove(d, di); - clear_tv(&vimvars[VV_KEY].vv_tv); } } hash_unlock(ht); @@ -10782,6 +10784,7 @@ filter_map_one(tv, expr, map, remp) if (*s != NUL) /* check for trailing chars after expr */ { EMSG2(_(e_invexpr2), s); + clear_tv(&rettv); goto theend; } if (map) |