updated for version 7.4.525
Problem: map() leaks memory when there is an error in the expression.
Solution: Call clear_tv(). (Christian Brabandt)
diff --git a/src/eval.c b/src/eval.c
index c7cc008..840e1e8 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -10720,18 +10720,20 @@
{
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 @@
if (*s != NUL) /* check for trailing chars after expr */
{
EMSG2(_(e_invexpr2), s);
+ clear_tv(&rettv);
goto theend;
}
if (map)
diff --git a/src/version.c b/src/version.c
index 890a49b..f65867c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 525,
+/**/
524,
/**/
523,