@@ -253,6 +253,8 @@ static int on_text(const char bytes[], size_t len, void *user)
253253 // We'll have at most len codepoints, plus one from a previous incomplete
254254 // sequence.
255255 codepoints = vterm_allocator_malloc (state -> vt , (len + 1 ) * sizeof (uint32_t ));
256+ if (codepoints == NULL )
257+ return 0 ;
256258
257259 encoding =
258260 state -> gsingle_set ? & state -> encoding [state -> gsingle_set ] :
@@ -330,6 +332,8 @@ static int on_text(const char bytes[], size_t len, void *user)
330332 break ;
331333
332334 chars = vterm_allocator_malloc (state -> vt , (glyph_ends - glyph_starts + 1 ) * sizeof (uint32_t ));
335+ if (chars == NULL )
336+ break ;
333337
334338 for ( ; i < glyph_ends ; i ++ ) {
335339 int this_width ;
@@ -1626,6 +1630,8 @@ static int on_resize(int rows, int cols, void *user)
16261630
16271631 if (cols != state -> cols ) {
16281632 unsigned char * newtabstops = vterm_allocator_malloc (state -> vt , (cols + 7 ) / 8 );
1633+ if (newtabstops == NULL )
1634+ return 0 ;
16291635
16301636 /* TODO: This can all be done much more efficiently bytewise */
16311637 int col ;
@@ -1651,6 +1657,8 @@ static int on_resize(int rows, int cols, void *user)
16511657
16521658 if (rows != state -> rows ) {
16531659 VTermLineInfo * newlineinfo = vterm_allocator_malloc (state -> vt , rows * sizeof (VTermLineInfo ));
1660+ if (newlineinfo == NULL )
1661+ return 0 ;
16541662
16551663 int row ;
16561664 for (row = 0 ; row < state -> rows && row < rows ; row ++ ) {
0 commit comments