From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73027 invoked by alias); 29 Apr 2015 20:43:19 -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 73000 invoked by uid 89); 29 Apr 2015 20:43:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 29 Apr 2015 20:43:18 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id D9E808E917 for ; Wed, 29 Apr 2015 20:43:16 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3TKhCdi028999 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 29 Apr 2015 16:43:15 -0400 Date: Thu, 30 Apr 2015 00:24:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org, Phil Muldoon Subject: Re: [PATCH v3 1/9] Code cleanup: Make parts of print_command_1 public Message-ID: <20150429204311.GA13516@host1.jankratochvil.net> References: <20150411194322.29128.52477.stgit@host1.jankratochvil.net> <20150411194333.29128.30245.stgit@host1.jankratochvil.net> <5540FC34.3050200@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5540FC34.3050200@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01089.txt.bz2 On Wed, 29 Apr 2015 17:43:48 +0200, Pedro Alves wrote: > I read the series, and AFAICS, this will be used by > compile_print_command in patch #7. But then AFAICS, compile_print_command > leaks fmtp. Yes, you are right it gets leaked in the end. > I think this all ends up simpler if it follows the pattern that > the current code already follows. It was reworked because struct format_data * becomes a part of struct do_module_cleanup which can be processed independently in the future. So the forgotten xfree was inteded+forgotten to be in do_module_cleanup. OTOH this COMPILE_I_PRINT_ADDRESS_SCOPE and COMPILE_I_PRINT_VALUE_SCOPE processing in do_module_cleanup is suppressed if the caller no longer exists (the 'compile print' command already finished). That means that you are right do_module_cleanup can depend on a local variable of the compile_print_command caller. I have to mention with sub-classing and C++ automatic memory management there would be nothing left to solve. Jan