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.
f1d13478e3
This commit is contained in:
Jan Edmund Lazo 2018-06-25 11:40:04 -04:00
parent fee4e39ca3
commit b79523681d

View File

@ -2352,8 +2352,8 @@ int do_ecmd(
} else {
// <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);
}