mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.1.0181: memory leak with trailing characters in skip expression
Problem: Memory leak with trailing characters in skip expression. Solution: Free the return value.
This commit is contained in:
@@ -729,6 +729,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
|
||||
return FAIL;
|
||||
if (*s != NUL) /* check for trailing chars after expr */
|
||||
{
|
||||
clear_tv(rettv);
|
||||
EMSG2(_(e_invexpr2), s);
|
||||
return FAIL;
|
||||
}
|
||||
|
@@ -324,6 +324,16 @@ func Test_searchpair_skip()
|
||||
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
|
||||
|
@@ -789,6 +789,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
181,
|
||||
/**/
|
||||
180,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user