diff mbox

[ada] : Use xasprintf instead of unchecked asprintf

Message ID CAFULd4Y8cCWEZBUqP8jGbCuvN9kRXRy=_GzsgZ=7p8rPx42_uQ@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Dec. 31, 2014, 3:04 p.m. UTC
Hello!

The ada part.

2014-12-31  Uros Bizjak  <ubizjak@gmail.com>

    * gcc-interface/misc.c (internal_error_function): Use xasprintf instead
    of unchecked asprintf.

Although almost trivial, this patch is *not* tested, so I'd kindly ask
someone to bootstrap and regresion test this patch.

Uros.

Comments

Eric Botcazou Jan. 3, 2015, 9:42 p.m. UTC | #1
> 2014-12-31  Uros Bizjak  <ubizjak@gmail.com>
> 
>     * gcc-interface/misc.c (internal_error_function): Use xasprintf instead
>     of unchecked asprintf.
> 
> Although almost trivial, this patch is *not* tested, so I'd kindly ask
> someone to bootstrap and regresion test this patch.

Sanity checked only, but that's good enough so you can apply it, thanks.
diff mbox

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 219123)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2014-12-31  Uros Bizjak  <ubizjak@gmail.com>
+
+	* gcc-interface/misc.c (internal_error_function): Use xasprintf instead
+	of unchecked asprintf.
+
 2014-12-22  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_{Min,Max}>: If the
Index: gcc-interface/misc.c
===================================================================
--- gcc-interface/misc.c	(revision 219123)
+++ gcc-interface/misc.c	(working copy)
@@ -326,9 +326,9 @@  internal_error_function (diagnostic_context *conte
 
   xloc = expand_location (input_location);
   if (context->show_column && xloc.column != 0)
-    asprintf (&loc, "%s:%d:%d", xloc.file, xloc.line, xloc.column);
+    loc = xasprintf ("%s:%d:%d", xloc.file, xloc.line, xloc.column);
   else
-    asprintf (&loc, "%s:%d", xloc.file, xloc.line);
+    loc = xasprintf ("%s:%d", xloc.file, xloc.line);
   temp_loc.Low_Bound = 1;
   temp_loc.High_Bound = strlen (loc);
   sp_loc.Bounds = &temp_loc;