]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.4.660 v7.4.660
authorBram Moolenaar <Bram@vim.org>
Fri, 13 Mar 2015 11:53:37 +0000 (12:53 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 13 Mar 2015 11:53:37 +0000 (12:53 +0100)
Problem:    Using freed memory when g:colors_name is changed in the colors
            script. (oni-link)
Solution:   Make a copy of the variable value.

src/syntax.c
src/version.c

index 483a9b02f4f2ed5a34f5d15c57a78691d57f8e0f..788a9f5aab07c107e6d7283584e2cbc5989b210d 100644 (file)
@@ -6988,8 +6988,22 @@ init_highlight(both, reset)
      * and 'background' or 't_Co' is changed.
      */
     p = get_var_value((char_u *)"g:colors_name");
-    if (p != NULL && load_colors(p) == OK)
-       return;
+    if (p != NULL)
+    {
+       /* The value of g:colors_name could be freed when sourcing the script,
+       * making "p" invalid, so copy it. */
+       char_u *copy_p = vim_strsave(p);
+       int    r;
+
+       if (copy_p != NULL)
+       {
+          r = load_colors(copy_p);
+          vim_free(copy_p);
+          if (r == OK)
+              return;
+       }
+    }
+
 #endif
 
     /*
index 21a910d702b64927107dc2185985d0798d33f6ac..11d2ff2e2261cb45628981b1fb5319d39a528e0c 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    660,
 /**/
     659,
 /**/