Merge pull request #5756 from jamessan/viminfo-leak

option.c: Update free_oldval after adjusting opt_idx for shada/viminfo
This commit is contained in:
James McCoy 2016-12-12 06:55:23 -05:00 committed by GitHub
commit 75c18b6aaa

View File

@ -2770,6 +2770,10 @@ did_set_string_option (
? ((shada_idx = findoption((char_u *) "shada"))) ? ((shada_idx = findoption((char_u *) "shada")))
: shada_idx) : shada_idx)
: opt_idx); : opt_idx);
// Update free_oldval now that we have the opt_idx for 'shada', otherwise
// there would be a disconnect between the check for P_ALLOCED at the start
// of the function and the set of P_ALLOCED at the end of the fuction.
free_oldval = (options[opt_idx].flags & P_ALLOCED);
for (s = p_shada; *s; ) { for (s = p_shada; *s; ) {
/* Check it's a valid character */ /* Check it's a valid character */
if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) { if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) {