mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 19:06:31 +00:00
vim-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.
a43ebe9454
This commit is contained in:
@@ -991,6 +991,7 @@ static int eval_expr_typval(const typval_T *expr, typval_T *argv,
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (*s != NUL) { // check for trailing chars after expr
|
if (*s != NUL) { // check for trailing chars after expr
|
||||||
|
tv_clear(rettv);
|
||||||
emsgf(_(e_invexpr2), s);
|
emsgf(_(e_invexpr2), s);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
@@ -325,6 +325,16 @@ func Test_searchpair_skip()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
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()
|
func Test_searchc()
|
||||||
" These commands used to cause memory overflow in searchc().
|
" These commands used to cause memory overflow in searchc().
|
||||||
new
|
new
|
||||||
|
Reference in New Issue
Block a user