public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Chen Gang S <gang.chen@sunrus.com.cn>
To: Michael Eager <eager@eagerm.com>, gdb-patches@sourceware.org
Cc: binutils@sourceware.org
Subject: Re: [PATCH] sim: Be sure of calling freeargv() after successfully call buildargv().
Date: Thu, 29 Jan 2015 04:53:00 -0000	[thread overview]
Message-ID: <54C9607B.5060304@sunrus.com.cn> (raw)
In-Reply-To: <54C905FE.6020207@eagerm.com>

On 1/28/15 23:53, Michael Eager wrote:
> On 01/28/15 03:45, Chen Gang S wrote:
>> buildargv() and freeargv() are pairs, so need be sure of them always
>> paired to avoid memory leak.
>>
>> 2015-01-28  Chen Gang <gang.chen.5i5j@gmail.com>
>>
>>     * common/sim-options.c (sim_args_command): Call freeargv() when
>>     failure occurs.
>>     * mcore/interp.c (sim_do_command): Call freeargv() before return.
>>     * microblaze/interp.c (sim_do_command): Call freeargv() before
>>     return.
> 
> 
> OK for Microblaze.
> 
> There appear to be other places where buildargv() is not followed by
> freeargv().  See sim/common/run.c.  There may be others.
> 

For me, I intended to skip buildargv() in "sim/common/run.c", because it
may contents read only memory. It is in main(), also main() often uses
exit(), so I skip it, it doesn't matter.

gdb also uses buildargv(), but it just wraps buildargv() and freeargv(),
so at least it is another patch (either, at least now, I do not find any
issues about it in gdb).

Except the above 2, for me, there are no any other places to use
buildargv().


Does the patch comments need to mention about the contents above?

Thanks.
-- 
Chen Gang

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

  reply	other threads:[~2015-01-28 22:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28 15:53 Chen Gang S
2015-01-28 20:43 ` Michael Eager
2015-01-29  4:53   ` Chen Gang S [this message]
2015-01-29  5:01     ` Michael Eager
2015-01-29  5:11       ` Chen Gang S
2015-02-17 10:36     ` Mike Frysinger
2015-01-29  7:03 ` Joel Brobecker
2015-01-29  7:28   ` Chen Gang S
2015-01-31  8:59 Chen Gang S
2015-01-31 11:56 Chen Gang S
2015-01-31 18:46 ` Michael Eager
2015-02-02 19:38   ` Chen Gang S
2015-02-03  2:50     ` Joel Brobecker
2015-02-03  9:58       ` Chen Gang S
2015-02-17 10:34 ` Mike Frysinger
2015-02-17 23:10   ` Chen Gang S
2015-02-18  0:22     ` Mike Frysinger
2015-02-19  0:34       ` Chen Gang S
2015-02-19 15:53         ` Michael Eager

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=54C9607B.5060304@sunrus.com.cn \
    --to=gang.chen@sunrus.com.cn \
    --cc=binutils@sourceware.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).