Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qPa6g-00BS3z-D9 for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Jul 2023 02:55:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qPa6e-0033FM-Si for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Jul 2023 02:55:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qPa6e-0033FD-JG for pgsql-hackers@lists.postgresql.org; Sat, 29 Jul 2023 02:55:00 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qPa6c-000zgD-H1 for pgsql-hackers@postgresql.org; Sat, 29 Jul 2023 02:55:00 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6310C5C012C; Fri, 28 Jul 2023 22:54:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 28 Jul 2023 22:54:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1690599297; x=1690685697; bh=p2 4pwYwegJoptNDhWdk2tADOo/UYHq4wu+fVYkKJRN8=; b=WGpLQaB+zWAeLn3Ajw lurT5d8Kghi9iGJKAfpI0in7OynyMN7+ZpLwkWCA18wWQUpE9mlUvUVsbvxq8jVk O2SgFAnQnksDOFiviPbt7qqQijE6sS33UFIWZHJgO8PRCadegiOBQdxrjifBmdWG hwYviT/N6GVRtVu/HM3HwOA8ZmICM3kq0s5+pj/ywAPnmyxsRcw3Y/F/NknUzs1D SC/WMtmM8JfOQDlhict6b/XnIKzoowNPsuvN7MjEsJSjseTF7GRfMwPxKPbhZNJF t0+LiThDaapx/M0O74fvd5FZ5kq4Fo9iYlaNk8Uv3rnBezIAmy/Oqx4SmUnfKc3z 7cFw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type: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=fm3; t=1690599297; x=1690685697; bh=p24pwYwegJopt NDhWdk2tADOo/UYHq4wu+fVYkKJRN8=; b=Y7yB3Kh35e4hbi71OMSijNK2T76NC Ljrrw+8Jryem1a2OjoPtFQI0vRrpz9WYKqLFhVlVAN9QXhkcBpBYxrv2Nvq/OYm5 5jr3qmyp3LQLP7J2DzX8VGopbyihDlTKHCIKy9n03u34ZtHP2moKTtOmbCtYrbWU FI4+gr2f6tYtIcLWnrt/bjuAbFDDNAf/v2DO4/hbG7aL2Tz/KKaIl3OgtEcp07A2 ww6D0e90hceS7hJhIz2fn+rcJ8pZRnEXN9vv58LrRTLw44aH+2IbgIoOEP1eXApk uwj+FA+IHQYUfY9obDpUK+G7gzg1xMX/j/ggT8e5FauJ/8EipDCAcThOQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrieejgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 28 Jul 2023 22:54:53 -0400 (EDT) Date: Sat, 29 Jul 2023 11:54:48 +0900 From: Michael Paquier To: Daniel Gustafsson Cc: Ranier Vilela , PostgreSQL Hackers Subject: Re: Avoid possible memory leak (src/common/rmtree.c) Message-ID: References: <3FE85611-3B27-4E88-B61B-36FEDE3F2C59@yesql.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iK6XAZKeK3P3wIrq" Content-Disposition: inline In-Reply-To: <3FE85611-3B27-4E88-B61B-36FEDE3F2C59@yesql.se> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --iK6XAZKeK3P3wIrq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 25, 2023 at 04:45:22PM +0200, Daniel Gustafsson wrote: > Skimming the tree there doesn't seem to be any callers which aren't exiting or > ereporting on failure so the real-world impact seems low. That being said, > silencing static analyzers could be reason enough to delay allocation. A different reason would be out-of-core code that uses rmtree() in a memory context where the leak would be an issue if facing a failure continuously? Delaying the allocation after the OPENDIR() seems like a good practice anyway. -- Michael --iK6XAZKeK3P3wIrq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmTEf3gACgkQnvQgOdby QH1OFxAAi7LGY0I+R66dUHcTjEiR+bq6STsOr9lXP+YFxnWBuwdsxT6EhGa3lWrs WtW6GdkUvWsrLBeDl/xfH4CG3e1hQzAWSNJDImylYCi32B/bOhhod437Qvy1Rf2X Wq3oAjUJVYvtA6YgucGvTJhC7YqBaDdYOH9dE9G6uennJzCB0vVgs0zrbfHSGu36 tlIPkZMKOz5Jbvm+mn3X9jto8sJa2U1kZ7w8awP2jP4irmEbLfsKgOov3uIT5/f3 C1wj03AzQMgyepOAc35oJVCPGj21c+wzCFiMFQhgZhwXx4PDXTfAs5PKWfvVcSJJ Z6eTD+hRK97Ai5CPp1T9PyIidugg5PE6upOjZKW0XfnRUxctT2CW5Akj6EDVzrMC na28dPNm6A4hPYzTK0dBjDiZozHfR7zk8acs3BTXZC/qVvAY38/F8Erm1hFcFzHy 7I7Ja21YOyAJaExi49UHzY91HY75HFyNlRxin2VHqIQKDT08TJ6SpHSBCUBq+GRj QaOVbEIenMDxnXL3Sitikm84aAz5fTkrV1ZYXE2zQRKu5xqu8sTpK7QMpGJcQ9An ytydNOv73LQzg3YygdiiM+M82HU261J9Ey6Nlexb3Cy2+GgLZM0l/v/bdGt0NLSc CFGmefgcoNk/vETsJcWfUcEZcPoY9oZ5boycx7MIjRp/YKcGD+E= =CAuT -----END PGP SIGNATURE----- --iK6XAZKeK3P3wIrq--