From affeb5c6ddbda0c34a9513e393d2b05f622e1514 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 24 Jun 2022 06:50:48 +0800 Subject: vim-patch:8.2.5146: memory leak when substitute expression nests Problem: Memory leak when substitute expression nests. Solution: Use an array of expression results. https://github.com/vim/vim/commit/44ddf19ec0ff59c969658ec7d9ed42070c59c51b Cherry-pick a comment change from patch 8.2.5057. N/A patches for version.c: vim-patch:8.2.5154: still mentioning version8, some cosmetic issues Problem: Still mentioning version8, some cosmetic issues. Solution: Prefer mentioning version9, cosmetic improvements. https://github.com/vim/vim/commit/abd56da30bae4a5c6c20b9363ccae12f7b126026 --- src/nvim/testdir/test_substitute.vim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index 2c24ce436f..8483435062 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -831,7 +831,7 @@ func Test_using_old_sub() ~ s/ endfunc - silent! s/\%')/\=Repl() + silent! s/\%')/\=Repl() delfunc Repl bwipe! @@ -1134,4 +1134,14 @@ func Test_substitute_short_cmd() bw! endfunc +" This should be done last to reveal a memory leak when vim_regsub_both() is +" called to evaluate an expression but it is not used in a second call. +func Test_z_substitute_expr_leak() + func SubExpr() + ~n + endfunc + silent! s/\%')/\=SubExpr() + delfunc SubExpr +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit