public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Joel Sherrill <joel@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] newlib/doc/makedoc.c: if realloc() fails, exit with an error message.
Date: Fri, 18 Jun 2021 19:43:30 +0000 (GMT)	[thread overview]
Message-ID: <20210618194330.8FAAF389247B@sourceware.org> (raw)

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;


                 reply	other threads:[~2021-06-18 19:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210618194330.8FAAF389247B@sourceware.org \
    --to=joel@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).