diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-01-12 21:58:08 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-01-12 21:58:08 +0000 |
commit | 39a3ae0a219ead81eeb3364aeafdd99a4cdefc6e (patch) | |
tree | edd94578e806522016a16111355f077e90441a57 /sim/common/sim-options.c | |
parent | 1b05df007beb1cbcc8cd9fd28d82d614a75e9432 (diff) | |
download | gdb-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-options.c')
-rw-r--r-- | sim/common/sim-options.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index b94c0ac..8ad71e7 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -621,7 +621,12 @@ sim_parse_args (SIM_DESC sd, char **argv) 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++; |