Mercurial > vim
changeset 17803:c9e52c1613ef v8.1.1898
patch 8.1.1898: crash when out of memory during startup
Commit: <a href="https://github.com/vim/vim/commit/4dc8f498aa3b1f58301914b57d75fea1dcad33ef">4dc8f498aa3b1f58301914b57d75fea1dcad33ef</a>
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 21 13:06:55 2019 +0200
patch 8.1.1898: crash when out of memory during startup
Problem: Crash when out of memory during startup.
Solution: When out of memory message given during initialisation bail out.
(closes #4842)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 21 Aug 2019 13:15:03 +0200 |
parents | cc99d500cfe2 |
children | 5f09328ccc88 |
files | src/misc2.c src/version.c |
diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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); } }