teardown: fix win_free_all() heap-use-after-free #10839

Fixes #10838
This commit is contained in:
Abdelhakeem Osama
2019-08-25 10:11:22 +03:00
committed by Justin M. Keyes
parent 34e4166673
commit 2e621553c0
2 changed files with 8 additions and 0 deletions

View File

@@ -2698,6 +2698,9 @@ void win_free_all(void)
win_T *wp = lastwin;
win_remove(lastwin, NULL);
(void)win_free_mem(wp, &dummy, NULL);
if (wp == aucmd_win) {
aucmd_win = NULL;
}
}
if (aucmd_win != NULL) {

View File

@@ -1510,5 +1510,10 @@ describe('API', function()
|
]])
end)
it('does not cause heap-use-after-free on exit while setting options', function()
command('au OptionSet * q')
command('silent! call nvim_create_buf(0, 1)')
end)
end)
end)