1
0
forked from aniani/vim

updated for version 7.4.525

Problem:    map() leaks memory when there is an error in the expression.
Solution:   Call clear_tv(). (Christian Brabandt)
This commit is contained in:
Bram Moolenaar
2014-11-19 20:04:48 +01:00
parent 2683c8e7f7
commit b738c9a442
2 changed files with 8 additions and 3 deletions

View File

@@ -10720,18 +10720,20 @@ filter_map(argvars, rettv, map)
{ {
if (!HASHITEM_EMPTY(hi)) if (!HASHITEM_EMPTY(hi))
{ {
int r;
--todo; --todo;
di = HI2DI(hi); di = HI2DI(hi);
if (tv_check_lock(di->di_tv.v_lock, if (tv_check_lock(di->di_tv.v_lock,
(char_u *)_(arg_errmsg))) (char_u *)_(arg_errmsg)))
break; break;
vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL r = filter_map_one(&di->di_tv, expr, map, &rem);
|| did_emsg) clear_tv(&vimvars[VV_KEY].vv_tv);
if (r == FAIL || did_emsg)
break; break;
if (!map && rem) if (!map && rem)
dictitem_remove(d, di); dictitem_remove(d, di);
clear_tv(&vimvars[VV_KEY].vv_tv);
} }
} }
hash_unlock(ht); hash_unlock(ht);
@@ -10782,6 +10784,7 @@ filter_map_one(tv, expr, map, remp)
if (*s != NUL) /* check for trailing chars after expr */ if (*s != NUL) /* check for trailing chars after expr */
{ {
EMSG2(_(e_invexpr2), s); EMSG2(_(e_invexpr2), s);
clear_tv(&rettv);
goto theend; goto theend;
} }
if (map) if (map)

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
525,
/**/ /**/
524, 524,
/**/ /**/