From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40026 invoked by alias); 26 Nov 2017 21:55:05 -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 40017 invoked by uid 89); 26 Nov 2017 21:55:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.150.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 26 Nov 2017 21:54:55 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway34.websitewelcome.com (Postfix) with ESMTP id E6EF124180 for ; Sun, 26 Nov 2017 15:54:53 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id J4t3edoaqHEImJ4t3efSTl; Sun, 26 Nov 2017 15:54:53 -0600 Received: from 71-218-90-63.hlrn.qwest.net ([71.218.90.63]:36952 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eJ4t3-001XW5-N7; Sun, 26 Nov 2017 15:54:53 -0600 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] python: Fix memleak in do_start_initialization References: <20171126035308.12274-1-simon.marchi@polymtl.ca> <87y3msvp9r.fsf@tromey.com> <46c74cbe-39a0-bcf0-e1b0-fcb9148c5303@polymtl.ca> Date: Sun, 26 Nov 2017 21:55:00 -0000 In-Reply-To: <46c74cbe-39a0-bcf0-e1b0-fcb9148c5303@polymtl.ca> (Simon Marchi's message of "Sun, 26 Nov 2017 15:55:59 -0500") Message-ID: <87po84vh77.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Source-L: No X-Exim-ID: 1eJ4t3-001XW5-N7 X-Source-Sender: 71-218-90-63.hlrn.qwest.net (bapiya) [71.218.90.63]:36952 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2017-11/txt/msg00676.txt.bz2 >>>>> "Simon" == Simon Marchi writes: Simon> There's already a comment in that regard: Hah, I totally missed this. Simon> When I read it, I thought it referred only to progname_copy, but it Simon> also applies to progname for Python 2. I integrated your suggestion, Simon> wdyt? Simon> - char *progname; Simon> + gdb::unique_xmalloc_ptr progname; I think the patch looks good, but would be even clearer if this declaration were moved into the #if, so that.. Simon> - progname = concat (ldirname (python_libdir).c_str (), SLASH_STRING, "bin", Simon> - SLASH_STRING, "python", (char *) NULL); Simon> + progname.reset (concat (ldirname (python_libdir).c_str (), SLASH_STRING, Simon> + "bin", SLASH_STRING, "python", (char *) NULL)); ...this reset could be replaced with plain initialization. thanks, Tom