This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] sim: Call freeargv() when failure occurs
- From: Chen Gang <gchen at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 2 Feb 2015 20:21:24 -0000
- Subject: [binutils-gdb] sim: Call freeargv() when failure occurs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c9ba137e2157b989b878198f94c7d5f01a937500
commit c9ba137e2157b989b878198f94c7d5f01a937500
Author: Chen Gang <gang.chen.5i5j@gmail.com>
Date: Sat Jan 31 05:58:51 2015 +0800
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.
Diff:
---
sim/ChangeLog | 5 +++++
sim/common/sim-options.c | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 03c244b..9ddee64 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
+
+ * common/sim-options.c (sim_args_command): Call freeargv() when
+ failure occurs.
+
2014-07-01 Chen Gang <gang.chen.5i5j@gmail.com>
* sim/microblaze/interp.c: Use long int format instead of int
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. */
{