Message ID | 54CC0E99.1070501@sunrus.com.cn |
---|---|
State | Committed |
Headers |
Received: (qmail 18071 invoked by alias); 30 Jan 2015 22:59:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 18050 invoked by uid 89); 30 Jan 2015 22:59:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, SPF_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-HELO: out2130-244.mail.aliyun.com Received: from out2130-244.mail.aliyun.com (HELO out2130-244.mail.aliyun.com) (42.156.130.244) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Jan 2015 22:59:26 +0000 X-Alimail-AntiSpam: AC=AD; BC=0.87176|0.1383885; BR=01201311R141b1; FP=0|0|0|0|0|-1|-1|-1; HT=r41g03009; MF=gang.chen@sunrus.com.cn; PH=DS; RN=1; RT=1; SR=0; Received: from ShengShiZhuChengdeMacBook-Pro.local(mailfrom:gang.chen@sunrus.com.cn ip:223.72.65.1) by smtp.aliyun-inc.com(10.147.11.249); Sat, 31 Jan 2015 06:59:21 +0800 Message-ID: <54CC0E99.1070501@sunrus.com.cn> Date: Sat, 31 Jan 2015 07:07:05 +0800 From: Chen Gang S <gang.chen@sunrus.com.cn> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [PATCH] sim: Be sure of calling freeargv() after successfully call buildargv(). Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit |
Commit Message
Chen Gang
Jan. 30, 2015, 11:07 p.m. UTC
Or there will be memory leak. 2014-01-31 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(+)
Comments
On 01/30/15 15:07, Chen Gang S wrote: > Or there will be memory leak. > > 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> > > * microblaze/interp.c (sim_do_command): Call freeargv() before > return. OK.
On 1/31/15 09:14, Michael Eager wrote: > On 01/30/15 15:07, Chen Gang S wrote: >> Or there will be memory leak. >> >> 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> >> Oh, sorry, the ChangeLog should use 2015-01-31 instead of 2014-01-31 for the all related 4 patches. I shall send patch v2 for them. Thanks.
Chen, > >> 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> > >> > > Oh, sorry, the ChangeLog should use 2015-01-31 instead of 2014-01-31 for > the all related 4 patches. I shall send patch v2 for them. One important thing to watch out for: I think you may not have realized that you pushed all 3 patches, whereas only the last one was approved. So, the first two ones weren't expected to be pushed yet. If you need help with git on how to push just the patches you want, let us know. One way, for instance, is to work in a separate branch, and then cherry-pick on master the patches only at the time where you want to push them. That's what I do, and prevents this kind of accident from happening. In the meantime, since the patches have been pushed, I reviewed them and they look good to me. So no need to revert. Normally, those are reviewed by the sim maintainer, so he may have additional comments.
On 02/03/2015 10:50 AM, Joel Brobecker wrote: > Chen, > >>>> 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> >>>> >> >> Oh, sorry, the ChangeLog should use 2015-01-31 instead of 2014-01-31 for >> the all related 4 patches. I shall send patch v2 for them. > > One important thing to watch out for: I think you may not have realized > that you pushed all 3 patches, whereas only the last one was approved. > So, the first two ones weren't expected to be pushed yet. If you need > help with git on how to push just the patches you want, let us know. > One way, for instance, is to work in a separate branch, and then > cherry-pick on master the patches only at the time where you want > to push them. That's what I do, and prevents this kind of accident > from happening. > OK, thanks. I shall notice about it next time. > In the meantime, since the patches have been pushed, I reviewed them > and they look good to me. So no need to revert. Normally, those are > reviewed by the sim maintainer, so he may have additional comments. > OK, thanks.
On 31 Jan 2015 07:07, Chen Gang S wrote: > --- a/sim/ChangeLog > +++ b/sim/ChangeLog > @@ -1,5 +1,10 @@ > 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> > > + * microblaze/interp.c (sim_do_command): Call freeargv() before > + return. this should be in sim/microblaze/ChangeLog instead. it looks like your last 4 entries in sim/ChangeLog need to get relocated. please do so. while you're there, you should also fix your gentmap.c entry in sim/common/ChangeLog -- only one space after the * is used. as for the actual code, lgtm. thanks for fixing up the various error paths. -mike
On 2/17/15 18:34, Mike Frysinger wrote: > On 31 Jan 2015 07:07, Chen Gang S wrote: >> --- a/sim/ChangeLog >> +++ b/sim/ChangeLog >> @@ -1,5 +1,10 @@ >> 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> >> >> + * microblaze/interp.c (sim_do_command): Call freeargv() before >> + return. > > this should be in sim/microblaze/ChangeLog instead. it looks like your last 4 > entries in sim/ChangeLog need to get relocated. please do so. > Oh, really, I shall change the related comments. > while you're there, you should also fix your gentmap.c entry in > sim/common/ChangeLog -- only one space after the * is used. > Oh, really, I shall change the related comments. > as for the actual code, lgtm. thanks for fixing up the various error paths. > -mike That what I should do, since I focus on binutils and gdb. :-) And excuse me, I am not quite familiar with the related working flow. Can I send 1 patch to fix the 2 comments, and "git push" it after it is reviewed?. Thanks.
On 18 Feb 2015 07:18, Chen Gang S wrote: > On 2/17/15 18:34, Mike Frysinger wrote: > > On 31 Jan 2015 07:07, Chen Gang S wrote: > >> --- a/sim/ChangeLog > >> +++ b/sim/ChangeLog > >> @@ -1,5 +1,10 @@ > >> 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> > >> > >> + * microblaze/interp.c (sim_do_command): Call freeargv() before > >> + return. > > > > this should be in sim/microblaze/ChangeLog instead. it looks like your last 4 > > entries in sim/ChangeLog need to get relocated. please do so. > > > > Oh, really, I shall change the related comments. > > > while you're there, you should also fix your gentmap.c entry in > > sim/common/ChangeLog -- only one space after the * is used. > > > > Oh, really, I shall change the related comments. > > > as for the actual code, lgtm. thanks for fixing up the various error paths. > > That what I should do, since I focus on binutils and gdb. :-) > > And excuse me, I am not quite familiar with the related working flow. > Can I send 1 patch to fix the 2 comments, and "git push" it after it is > reviewed?. generally the sim tree follows the gdb/binutils procedure. i.e. people should post patches to the list and wait for approval from a relevant maintainer. we don't generally get strict with the rules as long as you have good intentions and aren't breaking things (like compile failures) :). so don't get too worried and feel free to ask as people don't mind helping guide newbies. -mike
On 2/18/15 08:22, Mike Frysinger wrote: > On 18 Feb 2015 07:18, Chen Gang S wrote: >> On 2/17/15 18:34, Mike Frysinger wrote: >>> On 31 Jan 2015 07:07, Chen Gang S wrote: >>>> --- a/sim/ChangeLog >>>> +++ b/sim/ChangeLog >>>> @@ -1,5 +1,10 @@ >>>> 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> >>>> >>>> + * microblaze/interp.c (sim_do_command): Call freeargv() before >>>> + return. >>> >>> this should be in sim/microblaze/ChangeLog instead. it looks like your last 4 >>> entries in sim/ChangeLog need to get relocated. please do so. >>> >> >> Oh, really, I shall change the related comments. >> >>> while you're there, you should also fix your gentmap.c entry in >>> sim/common/ChangeLog -- only one space after the * is used. >>> >> >> Oh, really, I shall change the related comments. >> >>> as for the actual code, lgtm. thanks for fixing up the various error paths. >> >> That what I should do, since I focus on binutils and gdb. :-) >> >> And excuse me, I am not quite familiar with the related working flow. >> Can I send 1 patch to fix the 2 comments, and "git push" it after it is >> reviewed?. > > generally the sim tree follows the gdb/binutils procedure. i.e. people should > post patches to the list and wait for approval from a relevant maintainer. we > don't generally get strict with the rules as long as you have good intentions > and aren't breaking things (like compile failures) :). so don't get too worried > and feel free to ask as people don't mind helping guide newbies. > -mike > OK, thanks. I shall send one patch for the 2 comments, next. Thanks.
On 02/18/15 16:41, Chen Gang S wrote: > On 2/18/15 08:22, Mike Frysinger wrote: >> On 18 Feb 2015 07:18, Chen Gang S wrote: >>> On 2/17/15 18:34, Mike Frysinger wrote: >>>> On 31 Jan 2015 07:07, Chen Gang S wrote: >>>>> --- a/sim/ChangeLog >>>>> +++ b/sim/ChangeLog >>>>> @@ -1,5 +1,10 @@ >>>>> 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> >>>>> >>>>> + * microblaze/interp.c (sim_do_command): Call freeargv() before >>>>> + return. >>>> >>>> this should be in sim/microblaze/ChangeLog instead. it looks like your last 4 >>>> entries in sim/ChangeLog need to get relocated. please do so. >>>> >>> >>> Oh, really, I shall change the related comments. >>> >>>> while you're there, you should also fix your gentmap.c entry in >>>> sim/common/ChangeLog -- only one space after the * is used. >>>> >>> >>> Oh, really, I shall change the related comments. >>> >>>> as for the actual code, lgtm. thanks for fixing up the various error paths. >>> >>> That what I should do, since I focus on binutils and gdb. :-) >>> >>> And excuse me, I am not quite familiar with the related working flow. >>> Can I send 1 patch to fix the 2 comments, and "git push" it after it is >>> reviewed?. >> >> generally the sim tree follows the gdb/binutils procedure. i.e. people should >> post patches to the list and wait for approval from a relevant maintainer. we >> don't generally get strict with the rules as long as you have good intentions >> and aren't breaking things (like compile failures) :). so don't get too worried >> and feel free to ask as people don't mind helping guide newbies. >> -mike >> > > OK, thanks. I shall send one patch for the 2 comments, next. If all you are changing is correcting the ChangeLog as indicated, we can relax the normal procedure. Please just check in fixes.
diff --git a/sim/ChangeLog b/sim/ChangeLog index 1fe93df..582bd4a 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,5 +1,10 @@ 2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> + * microblaze/interp.c (sim_do_command): Call freeargv() before + return. + +2014-01-31 Chen Gang <gang.chen.5i5j@gmail.com> + * mcore/interp.c (sim_do_command): Call freeargv() before return. 2014-01-31 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 {