public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Chen Gang S <gang.chen@sunrus.com.cn>
To: gdb-patches@sourceware.org
Subject: [PATCH] sim: Call freeargv() when failure occurs
Date: Sat, 31 Jan 2015 08:57:00 -0000	[thread overview]
Message-ID: <54CC0E12.2010706@sunrus.com.cn> (raw)

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

                 reply	other threads:[~2015-01-30 22:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54CC0E12.2010706@sunrus.com.cn \
    --to=gang.chen@sunrus.com.cn \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).