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)
diff --git a/src/misc2.c b/src/misc2.c
index db8392c..8cdd0d4 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1014,14 +1014,19 @@
{
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);
}
}
diff --git a/src/version.c b/src/version.c
index 14a9528..0689e03 100644
--- a/src/version.c
+++ b/src/version.c
@@ -766,6 +766,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1898,
+/**/
1897,
/**/
1896,