newlib/doc/makedoc.c: if realloc() fails, exit with an error message.

This commit is contained in:
Joel Sherrill 2021-06-17 16:48:47 -05:00
parent 609f5a51c6
commit 90a72f27d5
1 changed files with 5 additions and 0 deletions

View File

@ -135,6 +135,11 @@ catchar (string_type *buffer, char ch)
{
buffer->size *=2;
buffer->ptr = realloc(buffer->ptr, buffer->size);
if (!buffer->ptr)
{
fprintf(stderr,"Can't allocate memory\n");
exit(1);
}
}
buffer->ptr[buffer->write_idx ++ ] = ch;