patch 9.1.1573: Memory leak when pressing Ctrl-D in cmdline mode
Commit:
https://github.com/vim/vim/commit/c02bef26fdfbffd442cbc5acef375256fa7fd6ff
Author: zeertzjq <[email protected]>
Date: Sun Jul 20 16:50:01 2025 +0200
patch 9.1.1573: Memory leak when pressing Ctrl-D in cmdline mode
Problem: Memory leak when pressing Ctrl-D in cmdline mode
(after 9.1.1571).
Solution: Free prev_cmdbuff before assigning to it.
(zeertzjq).
Existing tests already cover this. This change fixes the CI failure.
closes: #17807
Signed-off-by: zeertzjq <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 47187aa92..5ee94d219 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1822,6 +1822,8 @@ getcmdline_int(
int end_wildmenu;
int prev_cmdpos = ccline.cmdpos;
+ VIM_CLEAR(prev_cmdbuff);
+
redir_off = TRUE; // Don't redirect the typed command.
// Repeated, because a ":redir" inside
// completion may switch it on.
@@ -2574,10 +2576,7 @@ cmdline_not_changed:
#ifdef FEAT_SEARCH_EXTRA
if (!is_state.incsearch_postponed)
- {
- VIM_CLEAR(prev_cmdbuff);
continue;
- }
#endif
cmdline_changed:
@@ -2595,8 +2594,6 @@ cmdline_changed:
ccline.cmdbuff, prev_cmdpos) != 0)))
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
- VIM_CLEAR(prev_cmdbuff);
-
// Trigger CursorMovedC autocommands.
if (ccline.cmdpos != prev_cmdpos)
trigger_cmd_autocmd(cmdline_type, EVENT_CURSORMOVEDC);
diff --git a/src/version.c b/src/version.c
index b35dac242..251b4decb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1573,
/**/
1572,
/**/
--
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1udVWG-00HN33-Ai%40256bit.org.