From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23299 invoked by alias); 2 Feb 2015 20:09:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23280 invoked by uid 89); 2 Feb 2015 20:09:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-HELO: out2130-238.mail.aliyun.com Received: from out2130-238.mail.aliyun.com (HELO out2130-238.mail.aliyun.com) (42.156.130.238) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Feb 2015 20:09:11 +0000 X-Alimail-AntiSpam:AC=SUSPECT;BC=0.6140638|-1;BR=01201311R301b1;FP=0|0|0|0|0|-1|-1|-1;HT=r46d02013;MF=gang.chen@sunrus.com.cn;PH=DS;RN=2;RT=2;SR=0; Received: from ShengShiZhuChengdeMacBook-Pro.local(mailfrom:gang.chen@sunrus.com.cn ip:223.72.65.34) by smtp.aliyun-inc.com(10.147.11.251); Tue, 03 Feb 2015 04:09:08 +0800 Message-ID: <54CFDB35.9080909@sunrus.com.cn> Date: Mon, 02 Feb 2015 20:09:00 -0000 From: Chen Gang S 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, Michael Eager Subject: Re: [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv(). References: <54CFDAF2.5050904@sunrus.com.cn> In-Reply-To: <54CFDAF2.5050904@sunrus.com.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-02/txt/msg00032.txt.bz2 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 > > * 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 > > + * microblaze/interp.c (sim_do_command): Call freeargv() before > + return. > + > +2015-02-02 Chen Gang > + > * mcore/interp.c (sim_do_command): Call freeargv() before return. > > 2015-02-02 Chen Gang > 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