Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu79X-0004Qk-5l for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Mar 2018 01:48:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eu79U-0003oT-A3 for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Mar 2018 01:48:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu79T-0003lE-Ji for pgsql-bugs@lists.postgresql.org; Fri, 09 Mar 2018 01:48:56 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu79L-0005fV-Vh for pgsql-bugs@lists.postgresql.org; Fri, 09 Mar 2018 01:48:54 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id DED8612DE; Thu, 8 Mar 2018 20:48:45 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Thu, 08 Mar 2018 20:48:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=KwoN/SgkUbKrqqRDGTNKQ21uKpNcu8tdg5FkrcOyjLo=; b=A3SYEwHE 1bzp8uj4kcMehMt/PM9bF9VlVUyAAzTN1prEOIjMVG/muzZ6cVXp/oPqyCCsfuwF MFIwrrW/zYlIGog0CQeDPeP046bGya5g+duNYQcas1gD36Qt2qfLArM2YsrsR1DN mSoKqKIn+jqK/hyp5lcA/mekCkb5Tzqk3l9O/ahEZczk/ymybni+15ZE3wccC48/ 1NUX8bDtahuDvluWe1lWMlxaVtgOGBVm4Z9YKkMZ/gA3Ox+n9yQ6fyyN/R3E9ui2 DEuziPYmsI8kCmLIPvR60WR0jKCAqUP81pWN2oMqdh8TmE/3RKuFN0KqIBaDPwtb FDtBfOSSjSpkgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=KwoN/SgkUbKrqqRDGTNKQ21uKpNcu 8tdg5FkrcOyjLo=; b=Z5nXC9a/nRH5AHg/e6e4rdCTquVDDV4z4Paa50SK+/xyu mNR6GhOBdSE3n3hMbHzXPs4+A8JGZKOAjJ8bPmO1+cua8YMzoMBTMCK4Vl/ENClP cQ7kmWDMzRDbuqUlNZB+uLPzy3joUz7ZMqy2U0IeC1BHGq2ME8dIAc8i1YXU273V b7SZHahNUXdChmofsL3HadhnfyHTBBHbQMOdrFRy9ybqwc/SaRG52uTYr9dlrZRF FWUL6ErzUrutTDNcVZY14Aw+nPHmxbl9WWrCWmkrmhiMExyNVGpNOiFNXUqTbfm5 0IhGOfX+zxMQvXe+Whec9dMo9i8Ncs0wRIeNWqaqA== X-ME-Sender: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 63FB5245EC; Thu, 8 Mar 2018 20:48:44 -0500 (EST) Date: Fri, 9 Mar 2018 10:48:41 +0900 From: Michael Paquier To: bianpan2016@163.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15103: Do not use pfree() to free pg_malloc() return value in vacuum_one_database() Message-ID: <20180309014841.GA25687@paquier.xyz> References: <152055916778.4972.13890764985392726175@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wac7ysb48OaltWcw" Content-Disposition: inline In-Reply-To: <152055916778.4972.13890764985392726175@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Mar 09, 2018 at 01:32:47AM +0000, PG Bug reporting form wrote: > Details: In function vacuum_one_database(), the memory allocated with > pg_malloc() (at line 435), but the return value is freed with pfree() (at > line 530). I think use the function pg_free() paired with pg_malloc() is > better here. In practice it does not matter much as pfree is just a wrapper on top of pg_free(). Please see fe_memutils.c, which lists all the memory-related APIs for frontends. -- Michael --wac7ysb48OaltWcw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlqh5/kACgkQnvQgOdby QH3BYg//QCgmClTDv5rJsmKoPEmqiRkMmAummhkbazjEG19BHY7t2IErIWgv0SWY V5D2C+Hx3RinOBSIiXeUvdX0FELHoW5/mLZ3+pUDVu1ws2wFRzPakeEC9XUxexiO yC9fE35gceg8dAQ/vkGD+4rDoxbyXBXbXwCIY/qkYizVqLrg9qFIO3oIjdOIRmSY qFgybG8gf3cee9WaK8m45NXL6kqoilrTNuawlaBM149QjNQg+HKfgNUHuvguiHg9 EzJGDD1wZasSr5sAfAOxdfKV6CyOuH+nxiGS3t01EHK+EBQ19A3DP3riw3Lqdlar QznkR96r1UukJelOp24YHEnkJ+lg6ZfibzAnXIwLZR8nm8X824fUuryrbT7mzeRR GtpxaKcqtcBIOEigjexCfglLIdEvO5TDdaLjMdelaxYeWjxng/se9vC5UpBNx7P6 s9HE3dHr3q5BoIX1i6IWG8p0gMXzUjbeis9RUur0lQNd81gDQzyOfCXIHcJgJ8MT vAPR5WdGziHJl4MnuYXz5DOED6IlAARDli2zHmy1Ti6ja+exEWEvG7slx6NY6uXE k6da51U+oxtMfQ+OtKINXJcLs/NfsYRizn3Ln7BnhsVbxQf4wDY0ZhgV23VmjFgq pGRXly0AvgPudsY7Y2SeNEFq9mKXnHjQ7hfJsBYaChzxeafQ4Uk= =vVZh -----END PGP SIGNATURE----- --wac7ysb48OaltWcw--