Karsten Hopp ff700d
To: vim_dev@googlegroups.com
Karsten Hopp ff700d
Subject: Patch 7.4.297
Karsten Hopp ff700d
Fcc: outbox
Karsten Hopp ff700d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ff700d
Mime-Version: 1.0
Karsten Hopp ff700d
Content-Type: text/plain; charset=UTF-8
Karsten Hopp ff700d
Content-Transfer-Encoding: 8bit
Karsten Hopp ff700d
------------
Karsten Hopp ff700d
Karsten Hopp ff700d
Patch 7.4.297
Karsten Hopp ff700d
Problem:    Memory leak from result of get_isolated_shell_name().
Karsten Hopp ff700d
Solution:   Free the memory. (Dominique Pelle)
Karsten Hopp ff700d
Files:	    src/ex_cmds.c, src/misc1.c
Karsten Hopp ff700d
Karsten Hopp ff700d
Karsten Hopp ff700d
*** ../vim-7.4.296/src/ex_cmds.c	2014-05-09 20:33:01.098790466 +0200
Karsten Hopp ff700d
--- src/ex_cmds.c	2014-05-22 13:59:20.962535763 +0200
Karsten Hopp ff700d
***************
Karsten Hopp ff700d
*** 1554,1562 ****
Karsten Hopp ff700d
  
Karsten Hopp ff700d
  #if (defined(UNIX) && !defined(ARCHIE)) || defined(OS2)
Karsten Hopp ff700d
      int		is_fish_shell;
Karsten Hopp ff700d
  
Karsten Hopp ff700d
      /* Account for fish's different syntax for subshells */
Karsten Hopp ff700d
!     is_fish_shell = (fnamecmp(get_isolated_shell_name(), "fish") == 0);
Karsten Hopp ff700d
      if (is_fish_shell)
Karsten Hopp ff700d
  	len = (long_u)STRLEN(cmd) + 13;		/* "begin; " + "; end" + NUL */
Karsten Hopp ff700d
      else
Karsten Hopp ff700d
--- 1554,1564 ----
Karsten Hopp ff700d
  
Karsten Hopp ff700d
  #if (defined(UNIX) && !defined(ARCHIE)) || defined(OS2)
Karsten Hopp ff700d
      int		is_fish_shell;
Karsten Hopp ff700d
+     char_u	*shell_name = get_isolated_shell_name();
Karsten Hopp ff700d
  
Karsten Hopp ff700d
      /* Account for fish's different syntax for subshells */
Karsten Hopp ff700d
!     is_fish_shell = (fnamecmp(shell_name, "fish") == 0);
Karsten Hopp ff700d
!     vim_free(shell_name);
Karsten Hopp ff700d
      if (is_fish_shell)
Karsten Hopp ff700d
  	len = (long_u)STRLEN(cmd) + 13;		/* "begin; " + "; end" + NUL */
Karsten Hopp ff700d
      else
Karsten Hopp ff700d
*** ../vim-7.4.296/src/misc1.c	2014-05-13 12:44:19.897569605 +0200
Karsten Hopp ff700d
--- src/misc1.c	2014-05-22 13:58:52.254536347 +0200
Karsten Hopp ff700d
***************
Karsten Hopp ff700d
*** 10874,10880 ****
Karsten Hopp ff700d
  }
Karsten Hopp ff700d
  
Karsten Hopp ff700d
  /*
Karsten Hopp ff700d
!  * Returns the isolated name of the shell:
Karsten Hopp ff700d
   * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
Karsten Hopp ff700d
   * - Remove any argument.  E.g., "csh -f" -> "csh".
Karsten Hopp ff700d
   * But don't allow a space in the path, so that this works:
Karsten Hopp ff700d
--- 10874,10880 ----
Karsten Hopp ff700d
  }
Karsten Hopp ff700d
  
Karsten Hopp ff700d
  /*
Karsten Hopp ff700d
!  * Returns the isolated name of the shell in allocated memory:
Karsten Hopp ff700d
   * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
Karsten Hopp ff700d
   * - Remove any argument.  E.g., "csh -f" -> "csh".
Karsten Hopp ff700d
   * But don't allow a space in the path, so that this works:
Karsten Hopp ff700d
*** ../vim-7.4.296/src/version.c	2014-05-22 13:12:25.650592983 +0200
Karsten Hopp ff700d
--- src/version.c	2014-05-22 13:57:37.346537869 +0200
Karsten Hopp ff700d
***************
Karsten Hopp ff700d
*** 736,737 ****
Karsten Hopp ff700d
--- 736,739 ----
Karsten Hopp ff700d
  {   /* Add new patch number below this line */
Karsten Hopp ff700d
+ /**/
Karsten Hopp ff700d
+     297,
Karsten Hopp ff700d
  /**/
Karsten Hopp ff700d
Karsten Hopp ff700d
-- 
Karsten Hopp ff700d
A computer program does what you tell it to do, not what you want it to do.
Karsten Hopp ff700d
Karsten Hopp ff700d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ff700d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ff700d
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp ff700d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///