patch 9.1.1331: Leaking memory with cmdcomplete() Commit: https://github.com/vim/vim/commit/5c3d1e3258872381831f419765f2969f45caaa11 Author: Girish Palya <giris...@gmail.com> Date: Tue Apr 22 19:52:16 2025 +0200
patch 9.1.1331: Leaking memory with cmdcomplete() Problem: Leaking memory with cmdcomplete() (zeertzjq, after v9.1.1329) Solution: free the memory (Girish Palya) closes: #17190 Signed-off-by: Girish Palya <giris...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 70f3c88e3..0a1c3b127 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2025 Apr 21 +*builtin.txt* For Vim version 9.1. Last change: 2025 Apr 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1834,7 +1834,7 @@ clearmatches([{win}]) *clearmatches()* Return type: |Number| -cmdcomplete_info([{what}]) *cmdcomplete_info()* +cmdcomplete_info() *cmdcomplete_info()* Returns a |Dictionary| with information about cmdline completion. See |cmdline-completion|. The items are: diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 45f69bb2f..5b87d7804 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -1244,7 +1244,10 @@ showmatches(expand_T *xp, int wildmenu UNUSED) // Save cmdline before expansion if (ccline->cmdbuff != NULL) + { + vim_free(cmdline_orig); cmdline_orig = vim_strnsave(ccline->cmdbuff, ccline->cmdlen); + } if (xp->xp_numfiles == -1) { diff --git a/src/ex_getln.c b/src/ex_getln.c index 1137708ae..8445236ac 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1916,8 +1916,7 @@ getcmdline_int( } // Trigger CmdlineLeavePre autocommand - if (ccline.cmdfirstc != NUL && (c == ' ' || c == ' ' || c == K_KENTER - || c == ESC || c == Ctrl_C)) + if (c == ' ' || c == ' ' || c == K_KENTER || c == ESC || c == Ctrl_C) trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVEPRE); // The wildmenu is cleared if the pressed key is not used for diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index ae587117e..6f83b9cae 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2038,6 +2038,12 @@ func Test_Cmdline_Trigger() call assert_equal('', g:log) call feedkeys(":echo hello", "tx") call assert_equal('CmdlineLeavePre', g:log) + let g:count = 0 + autocmd CmdlineLeavePre * let g:count += 1 + call feedkeys(":let c = input('? ')\<cr>B\<cr>", "tx") + call assert_equal(2, g:count) + unlet! g:count + unlet! g:log bw! endfunc diff --git a/src/version.c b/src/version.c index 048788e60..2209282f8 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1331, /**/ 1330, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1u7Huk-001Njb-0Q%40256bit.org.