diff src/libvterm/src/termscreen.c @ 16429:a1229400434a v8.1.1219

patch 8.1.1219: not checking for NULL return from alloc() commit https://github.com/vim/vim/commit/6ee9658774942f7448af700fc04df0335796a3db Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 27 22:06:37 2019 +0200 patch 8.1.1219: not checking for NULL return from alloc() Problem: Not checking for NULL return from alloc(). Solution: Add checks. (Martin Kunev, closes https://github.com/vim/vim/issues/4303, closes https://github.com/vim/vim/issues/4174)
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Apr 2019 22:15:05 +0200
parents 544490b69e1d
children 811a12a78164
line wrap: on
line diff
--- a/src/libvterm/src/termscreen.c
+++ b/src/libvterm/src/termscreen.c
@@ -83,6 +83,8 @@ static ScreenCell *realloc_buffer(VTermS
   ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols);
   int row, col;
 
+  if (new_buffer == NULL)
+    return NULL;
   for(row = 0; row < new_rows; row++) {
     for(col = 0; col < new_cols; col++) {
       ScreenCell *new_cell = new_buffer + row*new_cols + col;