From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116114 invoked by alias); 3 Oct 2019 18:01:53 -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 116105 invoked by uid 89); 3 Oct 2019 18:01:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Oct 2019 18:01:52 +0000 Received: from [172.16.0.120] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 7566E1E592; Thu, 3 Oct 2019 14:01:50 -0400 (EDT) Subject: Re: [PATCH v2] gdb: CTF support To: Wei-min Pan , gdb-patches@sourceware.org References: <1564530195-27659-1-git-send-email-weimin.pan@oracle.com> <5377c457-52b0-583d-15b5-47024eae1f48@simark.ca> <895f47d4-3e01-4d5a-474b-43dd2dd037b4@oracle.com> <0fe82814-46b8-79c2-6a25-5f5d51b158e1@simark.ca> <1055d18f-9e5c-3344-114a-3777876c9c63@oracle.com> <3a67839f-73d0-06ed-4140-073306fc618d@simark.ca> From: Simon Marchi Message-ID: <75851ff5-771d-16fb-0a74-661c9e0722d3@simark.ca> Date: Thu, 03 Oct 2019 18:01:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-10/txt/msg00120.txt.bz2 On 2019-10-03 1:58 p.m., Wei-min Pan wrote: > But the `free` call is needed to free up space allocated by libctf's ctf_type_aname_raw. That's the point of gdb::unique_xmalloc_pointer: it will automatically call xfree (free) when on scope exit, free'ing this copy. It's preferred to use this instead of manually calling xfree, because it makes it harder to forget to free the memory (or to free it twice). Simon