forked from aniani/vim
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.
This commit is contained in:
18
src/syntax.c
18
src/syntax.c
@@ -6988,8 +6988,22 @@ init_highlight(both, reset)
|
|||||||
* and 'background' or 't_Co' is changed.
|
* and 'background' or 't_Co' is changed.
|
||||||
*/
|
*/
|
||||||
p = get_var_value((char_u *)"g:colors_name");
|
p = get_var_value((char_u *)"g:colors_name");
|
||||||
if (p != NULL && load_colors(p) == OK)
|
if (p != NULL)
|
||||||
return;
|
{
|
||||||
|
/* 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
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
660,
|
||||||
/**/
|
/**/
|
||||||
659,
|
659,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user