diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-07-14 17:25:01 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-07-14 17:25:01 +0200 |
commit | a43ebe9454386427ca38c75810e2d36991f17812 (patch) | |
tree | 54a2de5b033352d0526495a34d67e3186c54291f /src | |
parent | d6ef5f9b3d3df2d5dcc666c8741e99fcc77043f6 (diff) |
patch 8.1.0181: memory leak with trailing characters in skip expressionv8.1.0181
Problem: Memory leak with trailing characters in skip expression.
Solution: Free the return value.
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 1 | ||||
-rw-r--r-- | src/testdir/test_search.vim | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index 26aa0e34e7..4423419b17 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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; } diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index 9b078be396..28f0463c40 100644 --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -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 diff --git a/src/version.c b/src/version.c index 7275901843..e6a7d8b52b 100644 --- a/src/version.c +++ b/src/version.c @@ -790,6 +790,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 181, +/**/ 180, /**/ 179, |