sim: punt zfree()
[deliverable/binutils-gdb.git] / sim / common / sim-options.c
index c01cce5426b3cb8bcf6d1036b52233625d9f06e4..b726987da4f7007ba563691926daf17d0ae98d1c 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -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++;
@@ -664,11 +669,11 @@ sim_parse_args (SIM_DESC sd, char **argv)
        }
     }
 
-  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;
 }
 
This page took 0.024006 seconds and 4 git commands to generate.