0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.2414: using freed memory when closing the cmdline window

Problem:    Using freed memory when closing the cmdline window.
Solution:   Check the window is still valid.
This commit is contained in:
Bram Moolenaar
2021-01-26 22:00:52 +01:00
parent bb4b93ed85
commit b7e2670b6a
2 changed files with 8 additions and 1 deletions

View File

@@ -4395,10 +4395,15 @@ open_cmdwin(void)
// Avoid command-line window first character being concealed.
curwin->w_p_cole = 0;
# endif
// First go back to the original window.
wp = curwin;
set_bufref(&bufref, curbuf);
win_goto(old_curwin);
win_close(wp, TRUE);
// win_goto() may trigger an autocommand that already closes the
// cmdline window.
if (win_valid(wp))
win_close(wp, TRUE);
// win_close() may have already wiped the buffer when 'bh' is
// set to 'wipe'