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