comparison src/syntax.c @ 6671:476a12a96bb1 v7.4.660

updated for version 7.4.660 Problem: Using freed memory when g:colors_name is changed in the colors script. (oni-link) Solution: Make a copy of the variable value.
author Bram Moolenaar <bram@vim.org>
date Fri, 13 Mar 2015 12:53:37 +0100
parents d6473d6501fd
children 67e7a819c811
comparison
equal deleted inserted replaced
6670:48aaf49a6947 6671:476a12a96bb1
6986 /* 6986 /*
6987 * Try finding the color scheme file. Used when a color file was loaded 6987 * Try finding the color scheme file. Used when a color file was loaded
6988 * and 'background' or 't_Co' is changed. 6988 * and 'background' or 't_Co' is changed.
6989 */ 6989 */
6990 p = get_var_value((char_u *)"g:colors_name"); 6990 p = get_var_value((char_u *)"g:colors_name");
6991 if (p != NULL && load_colors(p) == OK) 6991 if (p != NULL)
6992 return; 6992 {
6993 /* The value of g:colors_name could be freed when sourcing the script,
6994 * making "p" invalid, so copy it. */
6995 char_u *copy_p = vim_strsave(p);
6996 int r;
6997
6998 if (copy_p != NULL)
6999 {
7000 r = load_colors(copy_p);
7001 vim_free(copy_p);
7002 if (r == OK)
7003 return;
7004 }
7005 }
7006
6993 #endif 7007 #endif
6994 7008
6995 /* 7009 /*
6996 * Didn't use a color file, use the compiled-in colors. 7010 * Didn't use a color file, use the compiled-in colors.
6997 */ 7011 */