From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id E687439ADC25 for ; Thu, 19 Aug 2021 18:04:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E687439ADC25 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-517-xNPQC-q5MxOV4tOEIGY_dA-1; Thu, 19 Aug 2021 14:04:24 -0400 X-MC-Unique: xNPQC-q5MxOV4tOEIGY_dA-1 Received: by mail-qv1-f72.google.com with SMTP id m10-20020a056214158ab029035a6c1e5f3eso5056451qvw.7 for ; Thu, 19 Aug 2021 11:04:24 -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:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=cfILr3pJm/vgWwlq80dprS49asNMOqYgYmlEf/IY1dg=; b=KwK6SWI9fVzpUY2CwobivAX4SWaaYudUUusBOecgiyyFk51vSF5DE9DUc6vxsThYGi 3M180a4fnlwQXM7qGtPIhG9Qquw5mTAj9qc/H0YOGkxfUN3AHJfkJo3cpgT/z7JARkCH dZi5nikPCXbIvPGK45O71iMshc1XstPPnYVpu17RmfNqWMVrTD6AoHmJ8TiWaIL8r8qp JdgDHTEuPmC/0vlKTGVQ8p32fslGYb9hUYK2JYXmo8eJet1fPwcZBD5qNkCTLDrZpyQE 5abYTXRn7kI6rfIPfYxM12BA4hzz0wfv2FlsKepTcJIzKZtcTbl9rOx+FJRzqCKUVmSx R+qg== X-Gm-Message-State: AOAM532kJF6s/FIKro1EmPcoH+NpOkarQtNlPgcjjh0wiues69hz7JMi oTW5WMcIp7lQ9fTUOISbFich4EZAFvxabqDyK59hPPzS02Gf9oUGlRe10iUSAwX38ZGQChz1m2r 9cvvOCvRh7lTPpgMd7idKG3aTfiODrFIEZUB4VY6YN/tODurPotAXV1GprqiLvJf/2Ndc3w== X-Received: by 2002:aed:304c:: with SMTP id 70mr14113852qte.2.1629396263854; Thu, 19 Aug 2021 11:04:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyW6kfndN4WnjNTFzzxVxB9+N8yuBUC5FjJCe7Sx3eTXaD1ZTRc9GgUkeLxTu//r4wUmzgd1w== X-Received: by 2002:aed:304c:: with SMTP id 70mr14113817qte.2.1629396263455; Thu, 19 Aug 2021 11:04:23 -0700 (PDT) Received: from [192.168.0.102] ([104.219.123.55]) by smtp.gmail.com with ESMTPSA id h140sm1991985qke.112.2021.08.19.11.03.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Aug 2021 11:03:54 -0700 (PDT) Subject: Re: [PATCH] document enable/disable_ranger To: Martin Sebor , Aldy Hernandez , gcc-patches References: <3f7e872f-f9e6-aa26-a028-a0c883bebed5@gmail.com> From: Andrew MacLeod Message-ID: Date: Thu, 19 Aug 2021 14:03:38 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <3f7e872f-f9e6-aa26-a028-a0c883bebed5@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-CA X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 18:04:30 -0000 On 8/19/21 1:30 PM, Martin Sebor wrote: > Hey Aldy & Andrew, > > I introduced a leak by calling enable_ranger() without pairing it > with one to disable_ranger() on the same function (PR 101984). > I didn't realize (or look to see) that enable_ranger() dynamically > allocates memory. > > The patch below adds comments to make it clear that the calls need > to be paired.  That seems obvious now but wasn't before from just > the function names.  So I'm wondering if we might want to rename > them to make it more obvious that the former involves allocating > memory that must be explicitly deallocated. > > If you agree, names along the following lines would make this > clearer (to me, anyway) but I'm open to others: > >   gimple_ranger *set_new_ranger (function *); >   void release_ranger (function *); I think the missing comments alone are enough for now. OK. Andrew