Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Chen Gang S <gang.chen@sunrus.com.cn>
To: gdb-patches@sourceware.org, Michael Eager <eager@eagerm.com>
Subject: Re: [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv().
Date: Mon, 02 Feb 2015 20:09:00 -0000	[thread overview]
Message-ID: <54CFDB35.9080909@sunrus.com.cn> (raw)
In-Reply-To: <54CFDAF2.5050904@sunrus.com.cn>


If there will be no any additional reply within this week, I shall apply
the related 3 patches to main branch.

Thanks.

On 2/3/15 04:15, Chen Gang S wrote:
> Or there will be memory leak.
> 
> 2015-02-02  Chen Gang <gang.chen.5i5j@gmail.com>
> 
> 	* microblaze/interp.c (sim_do_command): Call freeargv() before
> 	return.
> ---
>  sim/ChangeLog           | 5 +++++
>  sim/microblaze/interp.c | 3 +++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/sim/ChangeLog b/sim/ChangeLog
> index 1fe93df..582bd4a 100644
> --- a/sim/ChangeLog
> +++ b/sim/ChangeLog
> @@ -1,5 +1,10 @@
>  2015-02-02  Chen Gang <gang.chen.5i5j@gmail.com>
>  
> +	* microblaze/interp.c (sim_do_command): Call freeargv() before
> +	return.
> +
> +2015-02-02  Chen Gang <gang.chen.5i5j@gmail.com>
> +
>  	* mcore/interp.c (sim_do_command): Call freeargv() before return.
>  
>  2015-02-02  Chen Gang <gang.chen.5i5j@gmail.com>
> diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
> index 1c8a22d..4fc4595 100644
> --- a/sim/microblaze/interp.c
> +++ b/sim/microblaze/interp.c
> @@ -1019,6 +1019,7 @@ sim_do_command (SIM_DESC sd, const char *cmd)
>  	  if ((simargv[1] == NULL) || (simargv[2] == NULL))
>  	    {
>  	      fprintf (stderr, "Error: missing argument to watch cmd.\n");
> +	      freeargv (simargv);
>  	      return;
>  	    }
>  
> @@ -1062,6 +1063,8 @@ sim_do_command (SIM_DESC sd, const char *cmd)
>  	  fprintf (stderr,"Error: \"%s\" is not a valid M.CORE simulator command.\n",
>  		   cmd);
>  	}
> +
> +      freeargv (simargv);
>      }
>    else
>      {
> 

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed


  reply	other threads:[~2015-02-02 20:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 20:08 Chen Gang S
2015-02-02 20:09 ` Chen Gang S [this message]
2015-02-02 20:16   ` Michael Eager
2015-02-02 20:22     ` Chen Gang S
  -- strict thread matches above, loose matches on Subject: below --
2015-02-02 20:06 Chen Gang S

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=54CFDB35.9080909@sunrus.com.cn \
    --to=gang.chen@sunrus.com.cn \
    --cc=eager@eagerm.com \
    --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