/* Simulator option handling.
- Copyright (C) 1996, 1997, 2004, 2007, 2008, 2009, 2010
+ Copyright (C) 1996, 1997, 2004, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Contributed by Cygnus Support.
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++;
}
}
- zfree (long_options);
- zfree (short_options);
- zfree (handlers);
- zfree (opt_cpu);
- zfree (orig_val);
+ free (long_options);
+ free (short_options);
+ free (handlers);
+ free (opt_cpu);
+ free (orig_val);
return result;
}