aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-05-31 16:17:45 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-06-04 20:52:52 -0400
commit310a56d0a05deceea7df5a74f418f1df322ec9e1 (patch)
treed313b93bc4bc1f18700323e97f01b7b8d030a86c /src/nvim/buffer.c
parent64a2884d4cc78e3bbf1632cfe18d9e60a787a93e (diff)
downloadrneovim-310a56d0a05deceea7df5a74f418f1df322ec9e1.tar.gz
rneovim-310a56d0a05deceea7df5a74f418f1df322ec9e1.tar.bz2
rneovim-310a56d0a05deceea7df5a74f418f1df322ec9e1.zip
vim-patch:8.1.1895: using NULL pointer when out of memory
Problem: Using NULL pointer when out of memory. Solution: Bail out or skip the code using the pointer. (Zu-Ming Jiang, closes vim/vim#4805, closes vim/vim#4843, closes vim/vim#4939, closes vim/vim#4844) https://github.com/vim/vim/commit/6f10c70b59fa4e56aa479345fb0caeaac7429bfb
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 7c8f93163a..3ce39feda5 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -186,14 +186,17 @@ int open_buffer(
}
}
- /*
- * if there is no memfile at all, exit
- * This is OK, since there are no changes to lose.
- */
+ // If there is no memfile at all, exit.
+ // This is OK, since there are no changes to lose.
if (curbuf == NULL) {
EMSG(_("E82: Cannot allocate any buffer, exiting..."));
+
+ // Don't try to do any saving, with "curbuf" NULL almost nothing
+ // will work.
+ v_dying = 2;
getout(2);
}
+
EMSG(_("E83: Cannot allocate buffer, using other one..."));
enter_buffer(curbuf);
if (old_tw != curbuf->b_p_tw) {