99b86a7
To: vim-dev@vim.org
99b86a7
Subject: patch 7.1.113
99b86a7
Fcc: outbox
99b86a7
From: Bram Moolenaar <Bram@moolenaar.net>
99b86a7
Mime-Version: 1.0
99b86a7
Content-Type: text/plain; charset=ISO-8859-1
99b86a7
Content-Transfer-Encoding: 8bit
99b86a7
------------
99b86a7
99b86a7
Patch 7.1.113
99b86a7
Problem:    Using map() to go over an empty list causes memory to be freed
99b86a7
	    twice. (A.Politz)
99b86a7
Solution:   Don't clear the typeval in restore_vimvar().
99b86a7
Files:	    src/eval.c
99b86a7
99b86a7
99b86a7
*** ../vim-7.1.112/src/eval.c	Sun Sep 16 14:20:18 2007
99b86a7
--- src/eval.c	Sun Sep 16 19:24:49 2007
99b86a7
***************
99b86a7
*** 1318,1324 ****
99b86a7
  {
99b86a7
      hashitem_T	*hi;
99b86a7
  
99b86a7
-     clear_tv(&vimvars[idx].vv_tv);
99b86a7
      vimvars[idx].vv_tv = *save_tv;
99b86a7
      if (vimvars[idx].vv_type == VAR_UNKNOWN)
99b86a7
      {
99b86a7
--- 1318,1323 ----
99b86a7
***************
99b86a7
*** 1362,1368 ****
99b86a7
  
99b86a7
      if (p_verbose == 0)
99b86a7
  	--emsg_off;
99b86a7
-     vimvars[VV_VAL].vv_str = NULL;
99b86a7
      restore_vimvar(VV_VAL, &save_val);
99b86a7
  
99b86a7
      return list;
99b86a7
--- 1361,1366 ----
99b86a7
***************
99b86a7
*** 9387,9401 ****
99b86a7
  {
99b86a7
      typval_T	rettv;
99b86a7
      char_u	*s;
99b86a7
  
99b86a7
      copy_tv(tv, &vimvars[VV_VAL].vv_tv);
99b86a7
      s = expr;
99b86a7
      if (eval1(&s, &rettv, TRUE) == FAIL)
99b86a7
! 	return FAIL;
99b86a7
      if (*s != NUL)  /* check for trailing chars after expr */
99b86a7
      {
99b86a7
  	EMSG2(_(e_invexpr2), s);
99b86a7
! 	return FAIL;
99b86a7
      }
99b86a7
      if (map)
99b86a7
      {
99b86a7
--- 9386,9401 ----
99b86a7
  {
99b86a7
      typval_T	rettv;
99b86a7
      char_u	*s;
99b86a7
+     int		retval = FAIL;
99b86a7
  
99b86a7
      copy_tv(tv, &vimvars[VV_VAL].vv_tv);
99b86a7
      s = expr;
99b86a7
      if (eval1(&s, &rettv, TRUE) == FAIL)
99b86a7
! 	goto theend;
99b86a7
      if (*s != NUL)  /* check for trailing chars after expr */
99b86a7
      {
99b86a7
  	EMSG2(_(e_invexpr2), s);
99b86a7
! 	goto theend;
99b86a7
      }
99b86a7
      if (map)
99b86a7
      {
99b86a7
***************
99b86a7
*** 9414,9423 ****
99b86a7
  	/* On type error, nothing has been removed; return FAIL to stop the
99b86a7
  	 * loop.  The error message was given by get_tv_number_chk(). */
99b86a7
  	if (error)
99b86a7
! 	    return FAIL;
99b86a7
      }
99b86a7
      clear_tv(&vimvars[VV_VAL].vv_tv);
99b86a7
!     return OK;
99b86a7
  }
99b86a7
  
99b86a7
  /*
99b86a7
--- 9414,9425 ----
99b86a7
  	/* On type error, nothing has been removed; return FAIL to stop the
99b86a7
  	 * loop.  The error message was given by get_tv_number_chk(). */
99b86a7
  	if (error)
99b86a7
! 	    goto theend;
99b86a7
      }
99b86a7
+     retval = OK;
99b86a7
+ theend:
99b86a7
      clear_tv(&vimvars[VV_VAL].vv_tv);
99b86a7
!     return retval;
99b86a7
  }
99b86a7
  
99b86a7
  /*
99b86a7
*** ../vim-7.1.112/src/version.c	Sun Sep 16 14:20:18 2007
99b86a7
--- src/version.c	Mon Sep 17 21:33:52 2007
99b86a7
***************
99b86a7
*** 668,669 ****
99b86a7
--- 668,671 ----
99b86a7
  {   /* Add new patch number below this line */
99b86a7
+ /**/
99b86a7
+     113,
99b86a7
  /**/
99b86a7
99b86a7
-- 
99b86a7
Mental Floss prevents moral decay!
99b86a7
99b86a7
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
99b86a7
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
99b86a7
\\\        download, build and distribute -- http://www.A-A-P.org        ///
99b86a7
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///