]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.169 v7.3.169
authorBram Moolenaar <Bram@vim.org>
Thu, 28 Apr 2011 15:48:44 +0000 (17:48 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 28 Apr 2011 15:48:44 +0000 (17:48 +0200)
Problem:    Freeing memory already freed, warning from static code analyzer.
Solution:   Initialize pointers to NULL, correct use of "mustfree". (partly by
            Dominique Pelle)

src/misc1.c
src/version.c

index 8e3552ad67bb5447011b3e398004894d62ed801c..76c95257960a559401acee9dc2c94361d49f5a15 100644 (file)
@@ -3505,7 +3505,7 @@ init_homedir()
     if (enc_utf8 && var != NULL)
     {
        int     len;
-       char_u  *pp;
+       char_u  *pp = NULL;
 
        /* Convert from active codepage to UTF-8.  Other conversions are
         * not done, because they would fail for non-ASCII characters. */
@@ -3872,11 +3872,13 @@ expand_env_esc(srcp, dst, dstlen, esc, one, startstr)
  * Vim's version of getenv().
  * Special handling of $HOME, $VIM and $VIMRUNTIME.
  * Also does ACP to 'enc' conversion for Win32.
+ * "mustfree" is set to TRUE when returned is allocated, it must be
+ * initialized to FALSE by the caller.
  */
     char_u *
 vim_getenv(name, mustfree)
     char_u     *name;
-    int                *mustfree;      /* set to TRUE when returned is allocated */
+    int                *mustfree;
 {
     char_u     *p;
     char_u     *pend;
@@ -3898,7 +3900,7 @@ vim_getenv(name, mustfree)
        if (enc_utf8)
        {
            int     len;
-           char_u  *pp;
+           char_u  *pp = NULL;
 
            /* Convert from active codepage to UTF-8.  Other conversions are
             * not done, because they would fail for non-ASCII characters. */
@@ -3942,7 +3944,7 @@ vim_getenv(name, mustfree)
            if (enc_utf8)
            {
                int     len;
-               char_u  *pp;
+               char_u  *pp = NULL;
 
                /* Convert from active codepage to UTF-8.  Other conversions
                 * are not done, because they would fail for non-ASCII
@@ -3950,7 +3952,7 @@ vim_getenv(name, mustfree)
                acp_to_enc(p, (int)STRLEN(p), &pp, &len);
                if (pp != NULL)
                {
-                   if (mustfree)
+                   if (*mustfree)
                        vim_free(p);
                    p = pp;
                    *mustfree = TRUE;
index d4809d43aaa686ccd1475d62181f416343f1b3d6..55f8ec3fd626c94774cb7cec6c8b25429103a05a 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    169,
 /**/
     168,
 /**/