aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/arglist.c6
-rw-r--r--src/nvim/testdir/test_autocmd.vim9
2 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 4e122f1511..7019a6f461 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -490,6 +490,9 @@ void check_arg_idx(win_T *win)
void ex_args(exarg_T *eap)
{
if (eap->cmdidx != CMD_args) {
+ if (check_arglist_locked() == FAIL) {
+ return;
+ }
alist_unlink(ALIST(curwin));
if (eap->cmdidx == CMD_argglobal) {
ALIST(curwin) = &global_alist;
@@ -499,6 +502,9 @@ void ex_args(exarg_T *eap)
}
if (*eap->arg != NUL) {
+ if (check_arglist_locked() == FAIL) {
+ return;
+ }
// ":args file ..": define new argument list, handle like ":next"
// Also for ":argslocal file .." and ":argsglobal file ..".
ex_next(eap);
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index 07042eab32..c320d3ca78 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -3010,6 +3010,15 @@ func Test_Visual_doautoall_redraw()
%bwipe!
endfunc
+" This was using freed memory.
+func Test_BufNew_arglocal()
+ arglocal
+ au BufNew * arglocal
+ call assert_fails('drop xx', 'E1156:')
+
+ au! BufNew
+endfunc
+
func Test_autocmd_closes_window()
au BufNew,BufWinLeave * e %e
file yyy