aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-options.c
diff options
context:
space:
mode:
authorChen Gang <gang.chen.5i5j@gmail.com>2015-01-31 05:58:51 +0800
committerChen Gang <gang.chen.5i5j@gmail.com>2015-02-03 04:03:34 +0800
commitc9ba137e2157b989b878198f94c7d5f01a937500 (patch)
tree72c034b94d20bdc0ea753d04f07052f13bbc33f9 /sim/common/sim-options.c
parent24dd580891ed5fc331758d608b16d636eabd1ad3 (diff)
downloadgdb-c9ba137e2157b989b878198f94c7d5f01a937500.zip
gdb-c9ba137e2157b989b878198f94c7d5f01a937500.tar.gz
gdb-c9ba137e2157b989b878198f94c7d5f01a937500.tar.bz2
sim: Call freeargv() when failure occurs
After successfully call buildargv(), the code need to be sure of calling freeargv() in any cases. 2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com> * common/sim-options.c (sim_args_command): Call freeargv() when failure occurs.
Diffstat (limited to 'sim/common/sim-options.c')
-rw-r--r--sim/common/sim-options.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index c49220e..814edcf 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -993,7 +993,10 @@ sim_args_command (SIM_DESC sd, const char *cmd)
sim_cpu *cpu;
if (argv [0] == NULL)
- return SIM_RC_OK; /* FIXME - perhaps help would be better */
+ {
+ freeargv (argv);
+ return SIM_RC_OK; /* FIXME - perhaps help would be better */
+ }
/* First check for a cpu selector. */
{