diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-26 22:00:52 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-26 22:00:52 +0100 |
commit | b7e2670b6a1de02c772af5097ba24f2a15b26eec (patch) | |
tree | a02333b019edc8facfc5e1d50e7adea6df050ffd | |
parent | bb4b93ed85726c3921596ca267f531c8c94d819a (diff) |
patch 8.2.2414: using freed memory when closing the cmdline windowv8.2.2414
Problem: Using freed memory when closing the cmdline window.
Solution: Check the window is still valid.
-rw-r--r-- | src/ex_getln.c | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 5430014765..d025368218 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 c95b106bb5..071a36e861 100644 --- 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, |