From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25891 invoked by alias); 29 Jan 2015 00:04:20 -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 25853 invoked by uid 89); 29 Jan 2015 00:04:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: homiemail-a50.g.dreamhost.com Received: from sub5.mail.dreamhost.com (HELO homiemail-a50.g.dreamhost.com) (208.113.200.129) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Jan 2015 00:04:17 +0000 Received: from homiemail-a50.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a50.g.dreamhost.com (Postfix) with ESMTP id CCFED2024; Wed, 28 Jan 2015 16:04:15 -0800 (PST) Received: from redwood.eagercon.com (c-24-7-16-38.hsd1.ca.comcast.net [24.7.16.38]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: eager@eagerm.com) by homiemail-a50.g.dreamhost.com (Postfix) with ESMTPSA id A19142009; Wed, 28 Jan 2015 16:04:15 -0800 (PST) Message-ID: <54C978FF.8010303@eagerm.com> Date: Thu, 29 Jan 2015 05:01:00 -0000 From: Michael Eager User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Chen Gang S , 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> In-Reply-To: <54C9607B.5060304@sunrus.com.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00743.txt.bz2 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(). > > > Does the patch comments need to mention about the contents above? No, you don't need to mention what is not modified. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077