c1b829f
To: vim-dev@vim.org
c1b829f
Subject: Patch 7.0.168
c1b829f
Fcc: outbox
c1b829f
From: Bram Moolenaar <Bram@moolenaar.net>
c1b829f
Mime-Version: 1.0
c1b829f
Content-Type: text/plain; charset=ISO-8859-1
c1b829f
Content-Transfer-Encoding: 8bit
c1b829f
------------
c1b829f
c1b829f
Patch 7.0.168
c1b829f
Problem:    Using uninitialized memory and memory leak. (Dominique Pelle)
c1b829f
Solution:   Use alloc_clear() instead of alloc() for w_lines.  Free
c1b829f
	    b_ml.ml_stack after recovery.
c1b829f
Files:	    src/memline.c, src/window.c
c1b829f
c1b829f
c1b829f
*** ../vim-7.0.167/src/memline.c	Wed Nov  1 18:10:36 2006
c1b829f
--- src/memline.c	Thu Nov 16 22:29:19 2006
c1b829f
***************
c1b829f
*** 1329,1334 ****
c1b829f
--- 1329,1335 ----
c1b829f
  	    mf_put(mfp, hp, FALSE, FALSE);
c1b829f
  	mf_close(mfp, FALSE);	    /* will also vim_free(mfp->mf_fname) */
c1b829f
      }
c1b829f
+     vim_free(buf->b_ml.ml_stack);
c1b829f
      vim_free(buf);
c1b829f
      if (serious_error && called_from_main)
c1b829f
  	ml_close(curbuf, TRUE);
c1b829f
*** ../vim-7.0.167/src/window.c	Tue Oct 24 21:15:09 2006
c1b829f
--- src/window.c	Thu Nov 16 22:24:51 2006
c1b829f
***************
c1b829f
*** 4273,4279 ****
c1b829f
      win_T	*wp;
c1b829f
  {
c1b829f
      wp->w_lines_valid = 0;
c1b829f
!     wp->w_lines = (wline_T *)alloc((unsigned)(Rows * sizeof(wline_T)));
c1b829f
      if (wp->w_lines == NULL)
c1b829f
  	return FAIL;
c1b829f
      return OK;
c1b829f
--- 4273,4279 ----
c1b829f
      win_T	*wp;
c1b829f
  {
c1b829f
      wp->w_lines_valid = 0;
c1b829f
!     wp->w_lines = (wline_T *)alloc_clear((unsigned)(Rows * sizeof(wline_T)));
c1b829f
      if (wp->w_lines == NULL)
c1b829f
  	return FAIL;
c1b829f
      return OK;
c1b829f
*** ../vim-7.0.167/src/version.c	Tue Nov 21 19:36:00 2006
c1b829f
--- src/version.c	Tue Nov 21 20:34:13 2006
c1b829f
***************
c1b829f
*** 668,669 ****
c1b829f
--- 668,671 ----
c1b829f
  {   /* Add new patch number below this line */
c1b829f
+ /**/
c1b829f
+     168,
c1b829f
  /**/
c1b829f
c1b829f
-- 
c1b829f
   GALAHAD turns back.  We see from his POV the lovely ZOOT standing by him
c1b829f
   smiling enchantingly and a number of equally delectable GIRLIES draped
c1b829f
   around in the seductively poulticed room.  They look at him smilingly and
c1b829f
   wave.
c1b829f
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
c1b829f
c1b829f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
c1b829f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
c1b829f
\\\        download, build and distribute -- http://www.A-A-P.org        ///
c1b829f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///