Problem: Unused assignments when checking the value of 'listchars'.
Solution: Loop only once when just checking the value. Add a test to
check that this change doesn't cause double-free.
closes: #13559
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
}
// first round: check for valid value, second round: assign values
- for (round = 0; round <= 1; ++round)
+ for (round = 0; round <= (apply ? 1 : 0); ++round)
{
if (round > 0)
{
wp->w_fill_chars = fill_chars;
}
}
- else if (is_listchars)
- {
- vim_free(lcs_chars.multispace);
- vim_free(lcs_chars.leadmultispace);
- }
return NULL; // no error
}
call Check_listchars(expected, 5, 12)
call assert_equal(expected, split(execute("%list"), "\n"))
+ " Changing the value of 'ambiwidth' twice shouldn't cause double-free when
+ " "leadmultispace" is specified.
+ set ambiwidth=double
+ set ambiwidth&
+
" Test leadmultispace and lead and space
normal ggdG
set listchars&
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2126,
/**/
2125,
/**/