summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-20 22:58:37 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-20 22:58:37 +0200
commit6f10c70b59fa4e56aa479345fb0caeaac7429bfb (patch)
treecdbb54c3b73a4607d8bdebb116c962bb044246f5 /src/buffer.c
parent1058c9d9b5815467182d487f10f6dd71385cb796 (diff)
patch 8.1.1895: using NULL pointer when out of memoryv8.1.1895
Problem: Using NULL pointer when out of memory. Solution: Bail out or skip the code using the pointer. (Zu-Ming Jiang, closes #4805, closes #4843, closes #4939, closes #4844)
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 78801a8121..f9686a7bd8 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -181,14 +181,19 @@ open_buffer(
if (curbuf->b_ml.ml_mfp != NULL)
break;
/*
- * if there is no memfile at all, exit
+ * 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);
#ifdef FEAT_SYN_HL