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.
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 9b078be..28f0463 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -324,6 +324,16 @@
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