# HG changeset patch # User Bram Moolenaar # Date 1611695704 -3600 # Node ID 7c730cf4fb82188578cfe2e71e6af534edbb2031 # Parent d4166802a11efc3018cc9f1953b7c8b7d3c27929 patch 8.2.2414: using freed memory when closing the cmdline window Commit: https://github.com/vim/vim/commit/b7e2670b6a1de02c772af5097ba24f2a15b26eec Author: Bram Moolenaar Date: Tue Jan 26 22:00:52 2021 +0100 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. diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -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' diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2414, +/**/ 2413, /**/ 2412,