Skip to content

Commit c02bef2

Browse files
zeertzjqchrisbra
authored andcommitted
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]>
1 parent 9f4a80e commit c02bef2

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/ex_getln.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,8 @@ getcmdline_int(
18221822
int end_wildmenu;
18231823
int prev_cmdpos = ccline.cmdpos;
18241824

1825+
VIM_CLEAR(prev_cmdbuff);
1826+
18251827
redir_off = TRUE; // Don't redirect the typed command.
18261828
// Repeated, because a ":redir" inside
18271829
// completion may switch it on.
@@ -2574,10 +2576,7 @@ getcmdline_int(
25742576

25752577
#ifdef FEAT_SEARCH_EXTRA
25762578
if (!is_state.incsearch_postponed)
2577-
{
2578-
VIM_CLEAR(prev_cmdbuff);
25792579
continue;
2580-
}
25812580
#endif
25822581

25832582
cmdline_changed:
@@ -2595,8 +2594,6 @@ getcmdline_int(
25952594
ccline.cmdbuff, prev_cmdpos) != 0)))
25962595
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
25972596

2598-
VIM_CLEAR(prev_cmdbuff);
2599-
26002597
// Trigger CursorMovedC autocommands.
26012598
if (ccline.cmdpos != prev_cmdpos)
26022599
trigger_cmd_autocmd(cmdline_type, EVENT_CURSORMOVEDC);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ static char *(features[]) =
719719

720720
static int included_patches[] =
721721
{ /* Add new patch number below this line */
722+
/**/
723+
1573,
722724
/**/
723725
1572,
724726
/**/

0 commit comments

Comments
 (0)