Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4zBG-0000or-5R for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Dec 2022 06:54:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p4zBE-0005w4-V5 for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Dec 2022 06:54:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4zBD-0005vl-Tz for pgsql-hackers@lists.postgresql.org; Tue, 13 Dec 2022 06:54:20 +0000 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4zB9-0007ra-Ro for pgsql-hackers@postgresql.org; Tue, 13 Dec 2022 06:54:19 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id 385BB2B0671A; Tue, 13 Dec 2022 01:54:11 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 13 Dec 2022 01:54:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1670914450; x= 1670921650; bh=PgvQSD7s+A+rkCSoStqV/xID8S9j+QXT0J9UiBgSyFA=; b=r Dhj0liRGrDpu+h+jZh7BwckIibA3p740xQjKJ6qmrV2vxkZAchJZcfjx+oB1YTR4 p/dlxTFn9pbHAjwiCM6JXS2wqpygX81bf+ymCb6h374yy4ByPLsrsRzcFnLMG0xv m2gGPGICp/VBlrY4nU/LzTgquo2pT+znaC4uWfhc5GvMfUgQOEeg6fZumbOutds1 xNikDw1ehpyoWdXcc5qDA8bHqcXnhwUtXDnKuSI1bU+WOp3HEHPQST58/0ixMuo6 zKWSwtt82gG0SgH+38HHOr1Q/ryh9e+qD6FgrBY8gR1U+j4rNwR7LItt0Mqm88h4 DB4kqz851dHWYRa21HfTA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdelgddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnth gvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeehleffgeegudejteei hfelteduvdeifffhffdvjedvffegjeekudeludehudeifeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghu thesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 13 Dec 2022 01:54:09 -0500 (EST) Message-ID: <21375e35-07a2-a60e-c36e-286a46c9fc47@enterprisedb.com> Date: Tue, 13 Dec 2022 07:54:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: refactor ExecGrant_*() functions Content-Language: en-US To: Antonin Houska Cc: pgsql-hackers References: <22c7e802-4e7d-8d87-8b71-cba95e6f4bcf@enterprisedb.com> <24706.1670316118@antos> <4395c0b0-3938-5d87-27d1-cc99766745ce@enterprisedb.com> <3473.1670838279@antos> From: Peter Eisentraut In-Reply-To: <3473.1670838279@antos> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12.12.22 10:44, Antonin Houska wrote: > Peter Eisentraut wrote: > >> On 06.12.22 09:41, Antonin Houska wrote: >>> Attached are my proposals for improvements. One is to avoid memory leak, the >>> other tries to improve readability a little bit. >> >> I added the readability improvement to my v2 patch. The pfree() calls aren't >> necessary AFAICT. It's something to consider, but since this is a refactoring patch and the old code didn't do it either, I think it's out of scope. > I see that memory contexts exist and that the amount of memory freed is not > huge, but my style is to free the memory explicitly if it's allocated in a > loop. > > v2 looks good to me. Committed, thanks.