From b79523681d2b7cf7e1c1f0b9174aa3804e1d5811 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 25 Jun 2018 11:40:04 -0400 Subject: [PATCH] vim-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. https://github.com/vim/vim/commit/f1d13478e3a7e1a86d52552c8c5571f00dc28ad1 --- src/nvim/ex_cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index dbf11514cf..15b49b69ce 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2352,8 +2352,8 @@ int do_ecmd( } else { // 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); }