From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42078 invoked by alias); 22 Mar 2017 18:45: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 41909 invoked by uid 89); 22 Mar 2017 18:45:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy= X-HELO: mail-wr0-f176.google.com Received: from mail-wr0-f176.google.com (HELO mail-wr0-f176.google.com) (209.85.128.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Mar 2017 18:45:32 +0000 Received: by mail-wr0-f176.google.com with SMTP id u1so156851wra.2 for ; Wed, 22 Mar 2017 11:45:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=S9cB8RQURaqdO2io1nxiT9F2MtM/OxmuKxmY+spgB9Y=; b=dDd+0lhI7OgcBjOtQ4T2pKfBYG3rNEaGT+7oISoU3BWh1Wj84Bf7iZvF/qp40tSVgS yOjUhc3XJg+4o6M91HtdMh97mBrArOsCtbWGopWryv+8utSUIKR9ZtexS2RIihYIfNVu BdH/87PfpqXlY0Ba4JmgA2njTo+cofydWraf4QD6GfsUwtpxADR/j7xO0DtQ7nx4+fgg Ga7evRQj0gv6Y7eGRchONRV4jabAnkMju5SvCdB6+y+cEGz9oYcw6ClZHdAWPIV0xCpL 75QqZ3tp+hE521SyKPgcFktLScrjvtit1JRLcYfseHIfNpi0XdUxtFiFE0SiOOSIPHiX eQ2w== X-Gm-Message-State: AFeK/H1Q8PGC+9u6Z4CCKnCJbqouc8PWB4heJxJkvEcvownHP38opokd//04OCt71mLF+1y/ X-Received: by 10.223.175.196 with SMTP id y4mr37013440wrd.77.1490208330759; Wed, 22 Mar 2017 11:45:30 -0700 (PDT) Received: from [192.168.0.101] ([37.189.166.198]) by smtp.gmail.com with ESMTPSA id w10sm1351354wmw.14.2017.03.22.11.45.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 11:45:29 -0700 (PDT) Subject: Re: [PATCH] Fix memory leak in python.c:do_start_initialization To: Philipp Rudo References: <20170322131132.98976-1-prudo@linux.vnet.ibm.com> <20170322185224.40a2a37c@ThinkPad> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <1c478d49-d59a-1b58-a79e-844bd3db7fc8@redhat.com> Date: Wed, 22 Mar 2017 18:45:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170322185224.40a2a37c@ThinkPad> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-03/txt/msg00409.txt.bz2 On 03/22/2017 05:52 PM, Philipp Rudo wrote: >> OK with that change. Please push. > > Shall I fix it? Or do we go with your ldirname fix? Please push in your fix first. It's small and obviously correct. >> Perhaps better overall would be to make ldirname return a std::string >> and eliminate these leaks "by design". It'd get rid of several >> make_cleanup calls throughout too. I'll give that a quick try. > > Or maybe combining all path handling in a 'class gdbpath'. But > make ldirname return std::string definitely is an advantage. That'd be nice. If we do that, I think we should model the API on C++17's filesystem::path http://en.cppreference.com/w/cpp/filesystem/path , to ease a future transition. Thanks, Pedro Alves