0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

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)
This commit is contained in:
Bram Moolenaar 2019-08-21 13:06:55 +02:00
parent f1552d07d7
commit 4dc8f498aa
2 changed files with 10 additions and 3 deletions

View File

@ -1014,14 +1014,19 @@ do_outofmem_msg(size_t size)
{ {
if (!did_outofmem_msg) if (!did_outofmem_msg)
{ {
/* Don't hide this message */ // Don't hide this message
emsg_silent = 0; emsg_silent = 0;
/* Must come first to avoid coming back here when printing the error // Must come first to avoid coming back here when printing the error
* message fails, e.g. when setting v:errmsg. */ // message fails, e.g. when setting v:errmsg.
did_outofmem_msg = TRUE; did_outofmem_msg = TRUE;
semsg(_("E342: Out of memory! (allocating %lu bytes)"), (long_u)size); 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);
} }
} }

View File

@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1898,
/**/ /**/
1897, 1897,
/**/ /**/