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 <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
fa3b1043c6
commit
5c3d1e3258
@ -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)
|
||||
{
|
||||
|
||||
@ -1916,8 +1916,7 @@ getcmdline_int(
|
||||
}
|
||||
|
||||
// Trigger CmdlineLeavePre autocommand
|
||||
if (ccline.cmdfirstc != NUL && (c == '\n' || c == '\r' || c == K_KENTER
|
||||
|| c == ESC || c == Ctrl_C))
|
||||
if (c == '\n' || c == '\r' || 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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -704,6 +704,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1331,
|
||||
/**/
|
||||
1330,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user