From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30837 invoked by alias); 29 Jan 2015 01:36:52 -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 30808 invoked by uid 89); 29 Jan 2015 01:36:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: out1134-217.mail.aliyun.com Received: from out1134-217.mail.aliyun.com (HELO out1134-217.mail.aliyun.com) (42.120.134.217) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Jan 2015 01:36:47 +0000 X-Alimail-AntiSpam:AC=CONTINUE;BC=0.08688734|-1;FP=0|0|0|0|0|-1|-1|-1;HT=r46d02036;MF=gang.chen@sunrus.com.cn;PH=DS;RN=3;RT=3;SR=0; Received: from ShengShiZhuChengdeMacBook-Pro.local(mailfrom:gang.chen@sunrus.com.cn ip:124.127.118.42) by smtp.aliyun-inc.com(10.147.38.253); Thu, 29 Jan 2015 09:36:40 +0800 Message-ID: <54C99076.4050504@sunrus.com.cn> Date: Thu, 29 Jan 2015 05:11: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: Michael Eager , gdb-patches@sourceware.org CC: binutils@sourceware.org Subject: Re: [PATCH] sim: Be sure of calling freeargv() after successfully call buildargv(). References: <54C8CBC8.90102@sunrus.com.cn> <54C905FE.6020207@eagerm.com> <54C9607B.5060304@sunrus.com.cn> <54C978FF.8010303@eagerm.com> In-Reply-To: <54C978FF.8010303@eagerm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-01/txt/msg00744.txt.bz2 On 1/29/15 08:04, Michael Eager wrote: > On 01/28/15 14:19, Chen Gang S wrote: >> 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 >>>> >>>> * 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(). >> Oh, sorry, the 3rd sentence is incorrect, it should be: "Except the above 2, for me, there are no any other places to cause buildargv() related issues or doubts". >> >> Does the patch comments need to mention about the contents above? > > No, you don't need to mention what is not modified. > > OK, thanks. -- Chen Gang Open, share, and attitude like air, water, and life which God blessed