aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-utils.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-01-12 21:58:08 +0000
committerMike Frysinger <vapier@gentoo.org>2011-01-12 21:58:08 +0000
commit39a3ae0a219ead81eeb3364aeafdd99a4cdefc6e (patch)
treeedd94578e806522016a16111355f077e90441a57 /sim/common/sim-utils.c
parent1b05df007beb1cbcc8cd9fd28d82d614a75e9432 (diff)
downloadgdb-39a3ae0a219ead81eeb3364aeafdd99a4cdefc6e.zip
gdb-39a3ae0a219ead81eeb3364aeafdd99a4cdefc6e.tar.gz
gdb-39a3ae0a219ead81eeb3364aeafdd99a4cdefc6e.tar.bz2
sim: check asprintf return values
These are the last sources of build warnings (asprintf usage) that I see. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim/common/sim-utils.c')
-rw-r--r--sim/common/sim-utils.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index b76064e..1dbc4fb 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -336,7 +336,12 @@ sim_do_commandf (SIM_DESC sd,
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);