changeset 11649:0f7888a5ba68 v8.0.0707

patch 8.0.0707: freeing wrong memory with certain autocommands commit https://github.com/vim/vim/commit/f1d13478e3a7e1a86d52552c8c5571f00dc28ad1 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jul 11 18:28:46 2017 +0200 patch 8.0.0707: freeing wrong memory with certain autocommands Problem: Freeing wrong memory when manipulating buffers in autocommands. (James McCoy) Solution: Also set the w_s pointer if w_buffer was NULL.
author Christian Brabandt <cb@256bit.org>
date Tue, 11 Jul 2017 18:30:03 +0200
parents d5fe79b99de4
children 2a4e83ba20a5
files src/ex_cmds.c src/version.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3968,8 +3968,8 @@ do_ecmd(
 		     * <VN> We could instead free the synblock
 		     * and re-attach to buffer, perhaps.
 		     */
-		    if (curwin->w_buffer != NULL
-			    && curwin->w_s == &(curwin->w_buffer->b_s))
+		    if (curwin->w_buffer == NULL
+			    || curwin->w_s == &(curwin->w_buffer->b_s))
 			curwin->w_s = &(buf->b_s);
 #endif
 		    curwin->w_buffer = buf;
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    707,
+/**/
     706,
 /**/
     705,