Skip to content

Commit

Permalink
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Browse files Browse the repository at this point in the history
Problem:    Crash when wiping out a buffer after using getbufinfo().
            (Yegappan Lakshmanan)
Solution:   Remove b:changedtick from the buffer variables.
  • Loading branch information
brammool committed Oct 14, 2017
1 parent ac8069b commit b2c8750
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/buffer.c
Expand Up @@ -837,6 +837,8 @@ free_buffer(buf_T *buf)
++buf_free_count;
free_buffer_stuff(buf, TRUE);
#ifdef FEAT_EVAL
/* b:changedtick uses an item in buf_T, remove it now */
dictitem_remove(buf->b_vars, (dictitem_T *)&buf->b_ct_di);
unref_var_dict(buf->b_vars);
#endif
#ifdef FEAT_LUA
Expand Down
6 changes: 5 additions & 1 deletion src/testdir/test_autocmd.vim
Expand Up @@ -769,10 +769,14 @@ func Test_BufLeave_Wipe()
bwipe!
call assert_equal(1, line('$'))
call assert_equal('', bufname('%'))
call assert_equal(1, len(getbufinfo()))
let g:bufinfo = getbufinfo()
call assert_equal(1, len(g:bufinfo))

call delete('Xxx1')
call delete('Xxx2')
%bwipe
au! BufLeave

" check that bufinfo doesn't contain a pointer to freed memory
call test_garbagecollect_now()
endfunc
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -761,6 +761,8 @@ static char *(features[]) =

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

0 comments on commit b2c8750

Please sign in to comment.