public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: Call freeargv() when failure occurs
@ 2015-01-31  8:57 Chen Gang S
  0 siblings, 0 replies; only message in thread
From: Chen Gang S @ 2015-01-31  8:57 UTC (permalink / raw)
  To: gdb-patches

After successfully call buildargv(), the code need to be sure of calling
freeargv() in any cases.

2015-01-31  Chen Gang <gang.chen.5i5j@gmail.com>

       * common/sim-options.c (sim_args_command): Call freeargv() when
       failure occurs.
---
 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..7153c6a 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-31  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.  */
       {
-- 
1.9.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-30 22:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-31  8:57 [PATCH] sim: Call freeargv() when failure occurs Chen Gang S

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).