forked from aniani/vim
patch 8.0.1759: memory leak from duplicate options
Problem: Memory leak from duplicate options. (Yegappan Lakshmanan) Solution: Don't set the default value twice.
This commit is contained in:
@@ -3804,6 +3804,11 @@ set_option_default(
|
||||
{
|
||||
dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT;
|
||||
if (flags & P_STRING)
|
||||
{
|
||||
/* skip 'termkey' and 'termsize, they are duplicates of
|
||||
* 'termwinkey' and 'termwinsize' */
|
||||
if (STRCMP(options[opt_idx].fullname, "termkey") != 0
|
||||
&& STRCMP(options[opt_idx].fullname, "termsize") != 0)
|
||||
{
|
||||
/* Use set_string_option_direct() for local options to handle
|
||||
* freeing and allocating the value. */
|
||||
@@ -3818,6 +3823,7 @@ set_option_default(
|
||||
options[opt_idx].flags &= ~P_ALLOCED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & P_NUM)
|
||||
{
|
||||
if (options[opt_idx].indir == PV_SCROLL)
|
||||
|
@@ -761,6 +761,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1759,
|
||||
/**/
|
||||
1758,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user