Karsten Hopp 2f569f
To: vim-dev@vim.org
Karsten Hopp 2f569f
Subject: Patch 7.1.294
Karsten Hopp 2f569f
Fcc: outbox
Karsten Hopp 2f569f
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 2f569f
Mime-Version: 1.0
Karsten Hopp 2f569f
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 2f569f
Content-Transfer-Encoding: 8bit
Karsten Hopp 2f569f
------------
Karsten Hopp 2f569f
Karsten Hopp 2f569f
Patch 7.1.294
Karsten Hopp 2f569f
Problem:    Leaking memory when executing a shell command.
Karsten Hopp 2f569f
Solution:   Free memory when not able to save for undo. (Dominique Pelle)
Karsten Hopp 2f569f
Files:	    src/ex_cmds.c
Karsten Hopp 2f569f
Karsten Hopp 2f569f
*** ../vim-7.1.293/src/ex_cmds.c	Mon Feb 18 19:41:40 2008
Karsten Hopp 2f569f
--- src/ex_cmds.c	Sun Apr 13 13:20:15 2008
Karsten Hopp 2f569f
***************
Karsten Hopp 2f569f
*** 1160,1165 ****
Karsten Hopp 2f569f
--- 1166,1172 ----
Karsten Hopp 2f569f
      if (!do_out)
Karsten Hopp 2f569f
  	msg_putchar('\n');
Karsten Hopp 2f569f
  
Karsten Hopp 2f569f
+     /* Create the shell command in allocated memory. */
Karsten Hopp 2f569f
      cmd_buf = make_filter_cmd(cmd, itmp, otmp);
Karsten Hopp 2f569f
      if (cmd_buf == NULL)
Karsten Hopp 2f569f
  	goto filterend;
Karsten Hopp 2f569f
***************
Karsten Hopp 2f569f
*** 1180,1186 ****
Karsten Hopp 2f569f
--- 1187,1196 ----
Karsten Hopp 2f569f
      if (do_out)
Karsten Hopp 2f569f
      {
Karsten Hopp 2f569f
  	if (u_save((linenr_T)(line2), (linenr_T)(line2 + 1)) == FAIL)
Karsten Hopp 2f569f
+ 	{
Karsten Hopp 2f569f
+ 	    vim_free(cmd_buf);
Karsten Hopp 2f569f
  	    goto error;
Karsten Hopp 2f569f
+ 	}
Karsten Hopp 2f569f
  	redraw_curbuf_later(VALID);
Karsten Hopp 2f569f
      }
Karsten Hopp 2f569f
      read_linecount = curbuf->b_ml.ml_line_count;
Karsten Hopp 2f569f
***************
Karsten Hopp 2f569f
*** 4471,4477 ****
Karsten Hopp 2f569f
  	    /*
Karsten Hopp 2f569f
  	     * The new text is build up step by step, to avoid too much
Karsten Hopp 2f569f
  	     * copying.  There are these pieces:
Karsten Hopp 2f569f
! 	     * sub_firstline	The old text, unmodifed.
Karsten Hopp 2f569f
  	     * copycol		Column in the old text where we started
Karsten Hopp 2f569f
  	     *			looking for a match; from here old text still
Karsten Hopp 2f569f
  	     *			needs to be copied to the new text.
Karsten Hopp 2f569f
--- 4481,4487 ----
Karsten Hopp 2f569f
  	    /*
Karsten Hopp 2f569f
  	     * The new text is build up step by step, to avoid too much
Karsten Hopp 2f569f
  	     * copying.  There are these pieces:
Karsten Hopp 2f569f
! 	     * sub_firstline	The old text, unmodified.
Karsten Hopp 2f569f
  	     * copycol		Column in the old text where we started
Karsten Hopp 2f569f
  	     *			looking for a match; from here old text still
Karsten Hopp 2f569f
  	     *			needs to be copied to the new text.
Karsten Hopp 2f569f
*** ../vim-7.1.293/src/version.c	Wed Apr  9 15:48:08 2008
Karsten Hopp 2f569f
--- src/version.c	Wed May  7 13:07:48 2008
Karsten Hopp 2f569f
***************
Karsten Hopp 2f569f
*** 668,669 ****
Karsten Hopp 2f569f
--- 673,676 ----
Karsten Hopp 2f569f
  {   /* Add new patch number below this line */
Karsten Hopp 2f569f
+ /**/
Karsten Hopp 2f569f
+     294,
Karsten Hopp 2f569f
  /**/
Karsten Hopp 2f569f
Karsten Hopp 2f569f
-- 
Karsten Hopp 2f569f
It's not hard to meet expenses, they're everywhere.
Karsten Hopp 2f569f
Karsten Hopp 2f569f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 2f569f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 2f569f
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 2f569f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///