Skip to content

Commit

Permalink
patch 8.0.0707: freeing wrong memory with certain autocommands
Browse files Browse the repository at this point in the history
Problem:    Freeing wrong memory when manipulating buffers in autocommands.
            (James McCoy)
Solution:   Also set the w_s pointer if w_buffer was NULL.
  • Loading branch information
brammool committed Jul 11, 2017
1 parent 5a15b6a commit f1d1347
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ex_cmds.c
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -764,6 +764,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
707,
/**/
706,
/**/
Expand Down

0 comments on commit f1d1347

Please sign in to comment.