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