diff src/ops.c @ 17797:ec1717981acf v8.1.1895

patch 8.1.1895: using NULL pointer when out of memory commit https://github.com/vim/vim/commit/6f10c70b59fa4e56aa479345fb0caeaac7429bfb Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 20 22:58:37 2019 +0200 patch 8.1.1895: using NULL pointer when out of memory 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)
author Bram Moolenaar <Bram@vim.org>
date Tue, 20 Aug 2019 23:00:04 +0200
parents 0f7ae8010787
children 0b351691071c
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -4556,6 +4556,11 @@ do_join(
 
     /* allocate the space for the new line */
     newp = alloc(sumsize + 1);
+    if (newp == NULL)
+    {
+	ret = FAIL;
+	goto theend;
+    }
     cend = newp + sumsize;
     *cend = 0;