Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.147
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.147 (after 7.1.127)
Problem:    Freeing memory already freed when completing user name. (Meino
	    Cramer)
Solution:   Use a flag to remember if "orig" needs to be freed.
Files:	    src/ex_getln.c


*** ../vim-7.1.146/src/ex_getln.c	Sun Sep 30 22:10:45 2007
--- src/ex_getln.c	Tue Oct 30 17:13:33 2007
***************
*** 3353,3358 ****
--- 3353,3359 ----
      char_u	*ss = NULL;
      static int	findex;
      static char_u *orig_save = NULL;	/* kept value of orig */
+     int		orig_saved = FALSE;
      int		i;
      long_u	len;
      int		non_suf_match;		/* number without matching suffix */
***************
*** 3421,3426 ****
--- 3422,3428 ----
      {
  	vim_free(orig_save);
  	orig_save = orig;
+ 	orig_saved = TRUE;
  
  	/*
  	 * Do the expansion.
***************
*** 3546,3552 ****
  	ExpandCleanup(xp);
  
      /* Free "orig" if it wasn't stored in "orig_save". */
!     if (orig != orig_save)
  	vim_free(orig);
  
      return ss;
--- 3548,3554 ----
  	ExpandCleanup(xp);
  
      /* Free "orig" if it wasn't stored in "orig_save". */
!     if (!orig_saved)
  	vim_free(orig);
  
      return ss;
*** ../vim-7.1.146/src/version.c	Mon Oct 29 22:37:57 2007
--- src/version.c	Tue Oct 30 17:30:35 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     147,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
59. Your wife says communication is important in a marriage...so you buy
    another computer and install a second phone line so the two of you can
    chat.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///