public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] newlib/doc/makedoc.c: if realloc() fails, exit with an error message.
@ 2021-06-18 19:43 Joel Sherrill
  0 siblings, 0 replies; only message in thread
From: Joel Sherrill @ 2021-06-18 19:43 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=90a72f27d5f724b496525b54a5d9f99cdcecbb9c

commit 90a72f27d5f724b496525b54a5d9f99cdcecbb9c
Author: Joel Sherrill <joel@rtems.org>
Date:   Thu Jun 17 16:48:47 2021 -0500

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

Diff:
---
 newlib/doc/makedoc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c
index 966349c51..81aa6f941 100644
--- a/newlib/doc/makedoc.c
+++ b/newlib/doc/makedoc.c
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-18 19:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 19:43 [newlib-cygwin] newlib/doc/makedoc.c: if realloc() fails, exit with an error message Joel Sherrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).