diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-21 13:06:55 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-21 13:06:55 +0200 |
commit | 4dc8f498aa3b1f58301914b57d75fea1dcad33ef (patch) | |
tree | 9aa0c2df55444e42b2de476e855a9e8310ae5a47 /src/misc2.c | |
parent | f1552d07d715b437d941659479942c2543b02bd4 (diff) | |
download | vim-git-4dc8f498aa3b1f58301914b57d75fea1dcad33ef.tar.gz |
patch 8.1.1898: crash when out of memory during startupv8.1.1898
Problem: Crash when out of memory during startup.
Solution: When out of memory message given during initialisation bail out.
(closes #4842)
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/misc2.c b/src/misc2.c index db8392ccc..8cdd0d453 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1014,14 +1014,19 @@ do_outofmem_msg(size_t size) { if (!did_outofmem_msg) { - /* Don't hide this message */ + // Don't hide this message emsg_silent = 0; - /* Must come first to avoid coming back here when printing the error - * message fails, e.g. when setting v:errmsg. */ + // Must come first to avoid coming back here when printing the error + // message fails, e.g. when setting v:errmsg. did_outofmem_msg = TRUE; semsg(_("E342: Out of memory! (allocating %lu bytes)"), (long_u)size); + + if (starting == NO_SCREEN) + // Not even finished with initializations and already out of + // memory? Then nothing is going to work, exit. + mch_exit(123); } } |