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