]> granicus.if.org Git - vim/commitdiff
patch 8.0.0707: freeing wrong memory with certain autocommands v8.0.0707
authorBram Moolenaar <Bram@vim.org>
Tue, 11 Jul 2017 16:28:46 +0000 (18:28 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 11 Jul 2017 16:28:46 +0000 (18:28 +0200)
Problem:    Freeing wrong memory when manipulating buffers in autocommands.
            (James McCoy)
Solution:   Also set the w_s pointer if w_buffer was NULL.

src/ex_cmds.c
src/version.c

index 39f658a6e4f80652a2104095b0ee8f2636e778f2..a69a05268dbd4ef61657fdffd1e5c55d493ac42b 100644 (file)
@@ -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;
index 33399a47ab88083356207db28af33641a9cb5bdf..aaf76116b5cfdf183baa23f4520905d4b1e2f86b 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    707,
 /**/
     706,
 /**/