]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.525 v7.4.525
authorBram Moolenaar <Bram@vim.org>
Wed, 19 Nov 2014 19:04:48 +0000 (20:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 19 Nov 2014 19:04:48 +0000 (20:04 +0100)
Problem:    map() leaks memory when there is an error in the expression.
Solution:   Call clear_tv(). (Christian Brabandt)

src/eval.c
src/version.c

index c7cc0089d383d6740d6b74cadab2d504b50d478b..840e1e8f8249a709113505b0518ec3eeb3f41fa4 100644 (file)
@@ -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)
index 890a49bf0b2d8a57cc92b4d4c51d55b9de163138..f65867c43fc3ff8deb73aecfce988a212b8dcfa4 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    525,
 /**/
     524,
 /**/