These are the last sources of build warnings (asprintf usage) that I see.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+2011-01-12 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-module.c (sim_pre_argv_init): Return SIM_RC_FAIL when asprintf
+ fails.
+ * sim-options.c (sim_parse_args): Issue an error and return SIM_RC_FAIL
+ when asprintf fails.
+ * sim-utils.c (sim_do_commandf): Issue an error and return when
+ asprintf fails.
+ * sim-watch.c (sim_watchpoint_install): Return SIM_RC_FAIL when
+ asprintf fails.
+
2011-01-11 Mike Frysinger <vapier@gentoo.org>
* sim-memopt.c (do_memopt_add): Set nr_bytes to s.st_size before
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
{
char *name;
- asprintf (&name, "cpu%d", i);
+ if (asprintf (&name, "cpu%d", i) < 0)
+ return SIM_RC_FAIL;
CPU_NAME (STATE_CPU (sd, i)) = name;
}
}
char *name;
*lp = opt->opt;
/* Prepend --<cpuname>- to the option. */
- asprintf (&name, "%s-%s", CPU_NAME (cpu), lp->name);
+ if (asprintf (&name, "%s-%s", CPU_NAME (cpu), lp->name) < 0)
+ {
+ sim_io_eprintf (sd, "internal error, out of memory");
+ result = SIM_RC_FAIL;
+ break;
+ }
lp->name = name;
/* Dynamically assign `val' numbers for long options. */
lp->val = i++;
va_list ap;
char *buf;
va_start (ap, fmt);
- vasprintf (&buf, fmt, ap);
+ if (vasprintf (&buf, fmt, ap) < 0)
+ {
+ sim_io_eprintf (sd, "%s: asprintf failed for `%s'\n",
+ STATE_MY_NAME (sd), fmt);
+ return;
+ }
sim_do_command (sd, buf);
va_end (ap);
free (buf);
char *name;
int nr = interrupt_nr * nr_watchpoint_types + type;
OPTION *option = &int_options[nr];
- asprintf (&name, "watch-%s-%s",
- watchpoint_type_to_str (sd, type),
- interrupt_nr_to_str (sd, interrupt_nr));
+ if (asprintf (&name, "watch-%s-%s",
+ watchpoint_type_to_str (sd, type),
+ interrupt_nr_to_str (sd, interrupt_nr)) < 0)
+ return SIM_RC_FAIL;
option->opt.name = name;
option->opt.has_arg = required_argument;
option->opt.val = type_to_option (sd, type, interrupt_nr);