*/
static bfd_error_type bfd_error;
-static bfd *input_bfd;
static bfd_error_type input_error;
+static bfd *input_bfd;
+static char *input_error_msg;
const char *const bfd_errmsgs[] =
{
/* This is an error that occurred during bfd_close when writing an
archive, but on one of the input files. */
bfd_error = bfd_error_on_input;
+ free (input_error_msg);
+ input_error_msg = NULL;
input_bfd = input;
input_error = error_tag;
if (input_error >= bfd_error_on_input)
#endif
if (error_tag == bfd_error_on_input)
{
- char *buf;
const char *msg = bfd_errmsg (input_error);
- if (asprintf (&buf, _(bfd_errmsgs [error_tag]),
+ free (input_error_msg);
+ input_error_msg = NULL;
+ if (asprintf (&input_error_msg, _(bfd_errmsgs [error_tag]),
bfd_get_filename (input_bfd), msg) != -1)
- return buf;
+ return input_error_msg;
/* Ick, what to do on out of memory? */
return msg;
{
bfd_error = bfd_error_no_error;
input_bfd = NULL;
+ free (input_error_msg);
+ input_error_msg = NULL;
input_error = bfd_error_no_error;
_bfd_error_program_name = NULL;
_bfd_error_internal = error_handler_fprintf;