diff src/testdir/test_search.vim @ 14331:f8280e1bfc84 v8.1.0181

patch 8.1.0181: memory leak with trailing characters in skip expression commit https://github.com/vim/vim/commit/a43ebe9454386427ca38c75810e2d36991f17812 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 14 17:25:01 2018 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Sat, 14 Jul 2018 17:30:05 +0200
parents 0181a2cad0a1
children 3648e74dd523
line wrap: on
line diff
--- 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