Blame SOURCES/7.4.297

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