]> sourceware.org Git - newlib-cygwin.git/commitdiff
newlib/doc/makedoc.c: if realloc() fails, exit with an error message.
authorJoel Sherrill <joel@rtems.org>
Thu, 17 Jun 2021 21:48:47 +0000 (16:48 -0500)
committerJoel Sherrill <joel@rtems.org>
Thu, 17 Jun 2021 21:48:47 +0000 (16:48 -0500)
newlib/doc/makedoc.c

index 966349c51216fae28bea534ebeb6db05470412d1..81aa6f9412949892fa2c14be99922f52b23c9a61 100644 (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;
This page took 0.032571 seconds and 5 git commands to generate.