[PATCH] gengtype: don't test undefined value after vasprintf failure
Jim Meyering
jim@meyering.net
Wed Jul 15 13:48:00 GMT 2009
I did a quick scan for misuse of pointer values after failed
asprintf-style function uses and spotted a few. Here's a patch
for one of them:
[this patch is relative to just-updated "trunk"]
>From 1f71a26ec38860d863ca751aef049d314a4f34b4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 6 Jun 2009 19:10:47 +0200
Subject: [PATCH] gengtype: don't test undefined value after vasprintf failure
* gengtype.c (xasprintf): Don't test an undefined value upon
vasprintf failure.
---
gcc/gengtype.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 1b1e6fa..605dbfb 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -201,7 +201,7 @@ xasprintf (const char *format, ...)
va_start (ap, format);
n = vasprintf (&result, format, ap);
- if (result == NULL || n < 0)
+ if (n < 0)
fatal ("out of memory");
va_end (ap);
--
1.6.4.rc0.127.g81400
More information about the Gcc-bugs
mailing list