Problem: Memory leak with trailing characters in skip expression.
Solution: Free the return value.
return FAIL;
if (*s != NUL) /* check for trailing chars after expr */
{
+ clear_tv(rettv);
EMSG2(_(e_invexpr2), s);
return FAIL;
}
bw!
endfunc
+func Test_searchpair_leak()
+ new
+ call setline(1, 'if one else another endif')
+
+ " The error in the skip expression caused memory to leak.
+ call assert_fails("call searchpair('\\<if\\>', '\\<else\\>', '\\<endif\\>', '', '\"foo\" 2')", 'E15:')
+
+ bwipe!
+endfunc
+
func Test_searchc()
" These commands used to cause memory overflow in searchc().
new
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 181,
/**/
180,
/**/