diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-07-11 18:28:46 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-07-11 18:28:46 +0200 |
commit | f1d13478e3a7e1a86d52552c8c5571f00dc28ad1 (patch) | |
tree | af45e50787809567c61fe7d1621ec9d17b140e35 /src/ex_cmds.c | |
parent | 5a15b6aa0aa5c1559c6f1a9f06c595a8c564637d (diff) |
patch 8.0.0707: freeing wrong memory with certain autocommandsv8.0.0707
Problem: Freeing wrong memory when manipulating buffers in autocommands.
(James McCoy)
Solution: Also set the w_s pointer if w_buffer was NULL.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 39f658a6e4..a69a05268d 100644 --- 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; |