073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.525
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.525
073263
Problem:    map() leaks memory when there is an error in the expression.
073263
Solution:   Call clear_tv(). (Christian Brabandt)
073263
Files:	    src/eval.c
073263
073263
073263
*** ../vim-7.4.524/src/eval.c	2014-11-19 18:03:24.198559765 +0100
073263
--- src/eval.c	2014-11-19 20:01:36.426226654 +0100
073263
***************
073263
*** 10720,10737 ****
073263
  	    {
073263
  		if (!HASHITEM_EMPTY(hi))
073263
  		{
073263
  		    --todo;
073263
  		    di = HI2DI(hi);
073263
  		    if (tv_check_lock(di->di_tv.v_lock,
073263
  						     (char_u *)_(arg_errmsg)))
073263
  			break;
073263
  		    vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
073263
! 		    if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL
073263
! 								  || did_emsg)
073263
  			break;
073263
  		    if (!map && rem)
073263
  			dictitem_remove(d, di);
073263
- 		    clear_tv(&vimvars[VV_KEY].vv_tv);
073263
  		}
073263
  	    }
073263
  	    hash_unlock(ht);
073263
--- 10720,10739 ----
073263
  	    {
073263
  		if (!HASHITEM_EMPTY(hi))
073263
  		{
073263
+ 		    int r;
073263
+ 
073263
  		    --todo;
073263
  		    di = HI2DI(hi);
073263
  		    if (tv_check_lock(di->di_tv.v_lock,
073263
  						     (char_u *)_(arg_errmsg)))
073263
  			break;
073263
  		    vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
073263
! 		    r = filter_map_one(&di->di_tv, expr, map, &rem;;
073263
! 		    clear_tv(&vimvars[VV_KEY].vv_tv);
073263
! 		    if (r == FAIL || did_emsg)
073263
  			break;
073263
  		    if (!map && rem)
073263
  			dictitem_remove(d, di);
073263
  		}
073263
  	    }
073263
  	    hash_unlock(ht);
073263
***************
073263
*** 10782,10787 ****
073263
--- 10784,10790 ----
073263
      if (*s != NUL)  /* check for trailing chars after expr */
073263
      {
073263
  	EMSG2(_(e_invexpr2), s);
073263
+ 	clear_tv(&rettv);
073263
  	goto theend;
073263
      }
073263
      if (map)
073263
*** ../vim-7.4.524/src/version.c	2014-11-19 19:33:13.373532135 +0100
073263
--- src/version.c	2014-11-19 19:58:41.356215390 +0100
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     525,
073263
  /**/
073263
073263
-- 
073263
If an elephant is left tied to a parking meter, the parking fee has to be paid
073263
just as it would for a vehicle.
073263
		[real standing law in Florida, United States of America]
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///