From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62141 invoked by alias); 28 Dec 2018 17:21:44 -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 62129 invoked by uid 89); 28 Dec 2018 17:21:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:973, management X-HELO: mailsec112.isp.belgacom.be Received: from mailsec112.isp.belgacom.be (HELO mailsec112.isp.belgacom.be) (195.238.20.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Dec 2018 17:21:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1546017702; x=1577553702; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=SLNho/rpPJnBCJAwocqZH7ZWfAqM5vctoeU+rKFpxMI=; b=HodSyyQMU7r2goD6gOaCAJ1EVd/xsTtm/k9Z48ATfD+MiSRALLy+uv8K cgrIJPsyrOWNKmrvT4f1TWJfD9Gzmw==; Received: from 184.205-67-87.adsl-dyn.isp.belgacom.be (HELO md) ([87.67.205.184]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 28 Dec 2018 18:21:38 +0100 Message-ID: <1546017697.31031.21.camel@skynet.be> Subject: Re: [RFA] Fix leak of set/show verbose doc, avoid xfree of static string From: Philippe Waroquiers To: Tom Tromey Cc: gdb-patches@sourceware.org Date: Fri, 28 Dec 2018 17:21:00 -0000 In-Reply-To: <87lg49ob11.fsf@tromey.com> References: <20181228112644.28560-1-philippe.waroquiers@skynet.be> <87lg49ob11.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00389.txt.bz2 On Fri, 2018-12-28 at 09:45 -0700, Tom Tromey wrote: > > > > > > "Philippe" == Philippe Waroquiers writes: > > Philippe> gdb/ChangeLog > Philippe> 2018-12-28 Philippe Waroquiers > > Philippe> * top.c (set_verbose): Free previous docs if doc_allocated. > Philippe> Internationalize messages. Set doc_allocated to 0. > > Thanks for the patch. This is ok. Thanks for the review, pushed. > > Philippe> + if (c->doc && c->doc_allocated) > Philippe> + xfree ((char *) c->doc); > Philippe> + if (showcmd->doc && showcmd->doc_allocated) > Philippe> + xfree ((char *) showcmd->doc); > > Ideally I guess we'd have a better way of doing this. A lot of the CLI > machinery could use some cleanup, but for now this is still an "open" > struct. Effectively, as it is now, cmd_list_element memory management is not very well encapsulated. Philippe