Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
16428:6f69ef2913d7 | 16429:a1229400434a |
---|---|
81 static ScreenCell *realloc_buffer(VTermScreen *screen, ScreenCell *buffer, int new_rows, int new_cols) | 81 static ScreenCell *realloc_buffer(VTermScreen *screen, ScreenCell *buffer, int new_rows, int new_cols) |
82 { | 82 { |
83 ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols); | 83 ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols); |
84 int row, col; | 84 int row, col; |
85 | 85 |
86 if (new_buffer == NULL) | |
87 return NULL; | |
86 for(row = 0; row < new_rows; row++) { | 88 for(row = 0; row < new_rows; row++) { |
87 for(col = 0; col < new_cols; col++) { | 89 for(col = 0; col < new_cols; col++) { |
88 ScreenCell *new_cell = new_buffer + row*new_cols + col; | 90 ScreenCell *new_cell = new_buffer + row*new_cols + col; |
89 | 91 |
90 if(buffer && row < screen->rows && col < screen->cols) | 92 if(buffer && row < screen->rows && col < screen->cols) |