From: Bram Moolenaar Date: Tue, 26 Jan 2021 21:00:52 +0000 (+0100) Subject: patch 8.2.2414: using freed memory when closing the cmdline window X-Git-Tag: v8.2.2414 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7e2670b6a1de02c772af5097ba24f2a15b26eec;p=vim 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 index 543001476..d02536821 100644 --- 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 index c95b106bb..071a36e86 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2414, /**/ 2413, /**/