Karsten Hopp a5d42a
To: vim_dev@googlegroups.com
Karsten Hopp a5d42a
Subject: Patch 7.3.169
Karsten Hopp a5d42a
Fcc: outbox
Karsten Hopp a5d42a
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a5d42a
Mime-Version: 1.0
Karsten Hopp a5d42a
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a5d42a
Content-Transfer-Encoding: 8bit
Karsten Hopp a5d42a
------------
Karsten Hopp a5d42a
Karsten Hopp a5d42a
Patch 7.3.169
Karsten Hopp a5d42a
Problem:    Freeing memory already freed, warning from static code analyzer.
Karsten Hopp a5d42a
Solution:   Initialize pointers to NULL, correct use of "mustfree". (partly by
Karsten Hopp a5d42a
	    Dominique Pelle)
Karsten Hopp a5d42a
Files:	    src/mis1.c
Karsten Hopp a5d42a
Karsten Hopp a5d42a
Karsten Hopp a5d42a
*** ../vim-7.3.168/src/misc1.c	2011-04-28 13:01:59.000000000 +0200
Karsten Hopp a5d42a
--- src/misc1.c	2011-04-28 17:42:00.000000000 +0200
Karsten Hopp a5d42a
***************
Karsten Hopp a5d42a
*** 3505,3511 ****
Karsten Hopp a5d42a
      if (enc_utf8 && var != NULL)
Karsten Hopp a5d42a
      {
Karsten Hopp a5d42a
  	int	len;
Karsten Hopp a5d42a
! 	char_u  *pp;
Karsten Hopp a5d42a
  
Karsten Hopp a5d42a
  	/* Convert from active codepage to UTF-8.  Other conversions are
Karsten Hopp a5d42a
  	 * not done, because they would fail for non-ASCII characters. */
Karsten Hopp a5d42a
--- 3505,3511 ----
Karsten Hopp a5d42a
      if (enc_utf8 && var != NULL)
Karsten Hopp a5d42a
      {
Karsten Hopp a5d42a
  	int	len;
Karsten Hopp a5d42a
! 	char_u  *pp = NULL;
Karsten Hopp a5d42a
  
Karsten Hopp a5d42a
  	/* Convert from active codepage to UTF-8.  Other conversions are
Karsten Hopp a5d42a
  	 * not done, because they would fail for non-ASCII characters. */
Karsten Hopp a5d42a
***************
Karsten Hopp a5d42a
*** 3872,3882 ****
Karsten Hopp a5d42a
   * Vim's version of getenv().
Karsten Hopp a5d42a
   * Special handling of $HOME, $VIM and $VIMRUNTIME.
Karsten Hopp a5d42a
   * Also does ACP to 'enc' conversion for Win32.
Karsten Hopp a5d42a
   */
Karsten Hopp a5d42a
      char_u *
Karsten Hopp a5d42a
  vim_getenv(name, mustfree)
Karsten Hopp a5d42a
      char_u	*name;
Karsten Hopp a5d42a
!     int		*mustfree;	/* set to TRUE when returned is allocated */
Karsten Hopp a5d42a
  {
Karsten Hopp a5d42a
      char_u	*p;
Karsten Hopp a5d42a
      char_u	*pend;
Karsten Hopp a5d42a
--- 3872,3884 ----
Karsten Hopp a5d42a
   * Vim's version of getenv().
Karsten Hopp a5d42a
   * Special handling of $HOME, $VIM and $VIMRUNTIME.
Karsten Hopp a5d42a
   * Also does ACP to 'enc' conversion for Win32.
Karsten Hopp a5d42a
+  * "mustfree" is set to TRUE when returned is allocated, it must be
Karsten Hopp a5d42a
+  * initialized to FALSE by the caller.
Karsten Hopp a5d42a
   */
Karsten Hopp a5d42a
      char_u *
Karsten Hopp a5d42a
  vim_getenv(name, mustfree)
Karsten Hopp a5d42a
      char_u	*name;
Karsten Hopp a5d42a
!     int		*mustfree;
Karsten Hopp a5d42a
  {
Karsten Hopp a5d42a
      char_u	*p;
Karsten Hopp a5d42a
      char_u	*pend;
Karsten Hopp a5d42a
***************
Karsten Hopp a5d42a
*** 3898,3904 ****
Karsten Hopp a5d42a
  	if (enc_utf8)
Karsten Hopp a5d42a
  	{
Karsten Hopp a5d42a
  	    int	    len;
Karsten Hopp a5d42a
! 	    char_u  *pp;
Karsten Hopp a5d42a
  
Karsten Hopp a5d42a
  	    /* Convert from active codepage to UTF-8.  Other conversions are
Karsten Hopp a5d42a
  	     * not done, because they would fail for non-ASCII characters. */
Karsten Hopp a5d42a
--- 3900,3906 ----
Karsten Hopp a5d42a
  	if (enc_utf8)
Karsten Hopp a5d42a
  	{
Karsten Hopp a5d42a
  	    int	    len;
Karsten Hopp a5d42a
! 	    char_u  *pp = NULL;
Karsten Hopp a5d42a
  
Karsten Hopp a5d42a
  	    /* Convert from active codepage to UTF-8.  Other conversions are
Karsten Hopp a5d42a
  	     * not done, because they would fail for non-ASCII characters. */
Karsten Hopp a5d42a
***************
Karsten Hopp a5d42a
*** 3942,3948 ****
Karsten Hopp a5d42a
  	    if (enc_utf8)
Karsten Hopp a5d42a
  	    {
Karsten Hopp a5d42a
  		int	len;
Karsten Hopp a5d42a
! 		char_u  *pp;
Karsten Hopp a5d42a
  
Karsten Hopp a5d42a
  		/* Convert from active codepage to UTF-8.  Other conversions
Karsten Hopp a5d42a
  		 * are not done, because they would fail for non-ASCII
Karsten Hopp a5d42a
--- 3944,3950 ----
Karsten Hopp a5d42a
  	    if (enc_utf8)
Karsten Hopp a5d42a
  	    {
Karsten Hopp a5d42a
  		int	len;
Karsten Hopp a5d42a
! 		char_u  *pp = NULL;
Karsten Hopp a5d42a
  
Karsten Hopp a5d42a
  		/* Convert from active codepage to UTF-8.  Other conversions
Karsten Hopp a5d42a
  		 * are not done, because they would fail for non-ASCII
Karsten Hopp a5d42a
***************
Karsten Hopp a5d42a
*** 3950,3956 ****
Karsten Hopp a5d42a
  		acp_to_enc(p, (int)STRLEN(p), &pp, &len;;
Karsten Hopp a5d42a
  		if (pp != NULL)
Karsten Hopp a5d42a
  		{
Karsten Hopp a5d42a
! 		    if (mustfree)
Karsten Hopp a5d42a
  			vim_free(p);
Karsten Hopp a5d42a
  		    p = pp;
Karsten Hopp a5d42a
  		    *mustfree = TRUE;
Karsten Hopp a5d42a
--- 3952,3958 ----
Karsten Hopp a5d42a
  		acp_to_enc(p, (int)STRLEN(p), &pp, &len;;
Karsten Hopp a5d42a
  		if (pp != NULL)
Karsten Hopp a5d42a
  		{
Karsten Hopp a5d42a
! 		    if (*mustfree)
Karsten Hopp a5d42a
  			vim_free(p);
Karsten Hopp a5d42a
  		    p = pp;
Karsten Hopp a5d42a
  		    *mustfree = TRUE;
Karsten Hopp a5d42a
*** ../vim-7.3.168/src/version.c	2011-04-28 17:30:05.000000000 +0200
Karsten Hopp a5d42a
--- src/version.c	2011-04-28 17:48:04.000000000 +0200
Karsten Hopp a5d42a
***************
Karsten Hopp a5d42a
*** 716,717 ****
Karsten Hopp a5d42a
--- 716,719 ----
Karsten Hopp a5d42a
  {   /* Add new patch number below this line */
Karsten Hopp a5d42a
+ /**/
Karsten Hopp a5d42a
+     169,
Karsten Hopp a5d42a
  /**/
Karsten Hopp a5d42a
Karsten Hopp a5d42a
-- 
Karsten Hopp a5d42a
A day without sunshine is like, well, night.
Karsten Hopp a5d42a
Karsten Hopp a5d42a
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a5d42a
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a5d42a
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a5d42a
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///