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