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.96) (envelope-from ) id 1wAaOd-0006t1-0b for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 21:25:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAaOb-002FdR-1P for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 21:25:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wAaOa-002FdJ-2R for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 21:25:10 +0000 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wAaOZ-000000003bc-239Q for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 21:25:08 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id 629E41D0012D; Wed, 8 Apr 2026 17:25:06 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Wed, 08 Apr 2026 17:25:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1775683506; x=1775769906; bh=5M4fz7czh4cF5w+N3foTe17TzjWlkknD phf4RUeJKDA=; b=f2uu+0l9y4KNZx2CCed3uqtSeDKq0BcTH0IEzYPRM8EhKGnI ocorvKfeYYJr/jYOwcS/QPQ6OMZKnmhZw2i2u4T0x3RMrUS2d2t+w8WIj7hc8wqr 67WoOumLCbFVs2lPn06acOLSWEQNxqpZXEIlYWZm0G/3GPE7bcG5lJpbvCaN0c3x HSkShiWOsnBSzJkNZ1ukfV2mWee+pgJAfJxBnE5lM9GebNQx1P7SgLC2aaIRKFb0 egTNLo8jLkOxYcFEOjwfT8P4eiv3DOZGmGLi0KJubHEAe+8XpPMh2VYdW8NNt+Vn PV7RM+sUabEHAQ01llWrIHI7SKjNFzRbPz+irA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1775683506; x= 1775769906; bh=5M4fz7czh4cF5w+N3foTe17TzjWlkknDphf4RUeJKDA=; b=H /L4bFDZTF3ndXE7wx1ZNtnWfZ6tBho4JFQ9hQc2lp84cpVnEO2OOdC3tvT2SKdGw SL4oIinWVFWF+86teFrD+BWrEKcWPnkwseu0XBO6oAwlX8v9+x/Xi+R+kOLdOJoP ith9tSgz7q0/a6uDhpQLUxD+jSIWhZn9fHWN7fA4aY6YLGywfP6gp6oTDvIjeSm0 TzpsO2+PM32TA3W9tXshA5xinjZxqPnFuQzWNHbfhQMfitTX5DWqOz42ADbXBudB sYOD3ODs2IfJCzS44PXUPdKElgXf1IYhIRlaLslJVHnDNfeGrQNOdvmOiUSOBSDn lOhnYEWsQjqglNIHMhAog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvgeeigecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheprfgvthgvrhcu gfhishgvnhhtrhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqeenuc ggtffrrghtthgvrhhnpeeljedtudfggffffefhieetfeehtedukeejuedtlefhgefgffdu jeehueefudffkeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghi shgvnhhtrhgruhhtrdhorhhgpdhnsggprhgtphhtthhopeehpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehjrggtohgsrdgthhgrmhhpihhonhesvghnthgvrhhprhhishgv uggsrdgtohhmpdhrtghpthhtoheprghnughrvghssegrnhgrrhgriigvlhdruggvpdhrtg hpthhtoheprghnughrvggrshesphhrohigvghlrdhsvgdprhgtphhtthhopehgrghlkhhi nhesrhhuthhokhgvnhdrrhhupdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslh hishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Apr 2026 17:25:04 -0400 (EDT) Message-ID: Date: Wed, 8 Apr 2026 23:25:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: DEREF_AFTER_NULL: src/common/jsonapi.c:2529 To: Jacob Champion , Andres Freund Cc: Andreas Karlsson , =?UTF-8?B?0JPQsNC70LrQuNC9INCh0LU=?= =?UTF-8?B?0YDQs9C10Lk=?= , "pgsql-hackers@lists.postgresql.org" References: <0b32e30f2fb94ae3b7f4ee15bbb072c0@rutoken.ru> <107eb23a-8ebb-42bc-99c0-ca551733e94e@proxel.se> Content-Language: de-DE, en-US From: Peter Eisentraut In-Reply-To: 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 07.04.26 00:01, Jacob Champion wrote: >>> Or else make pfree() behave like free() [2] so that we don't >>> have to have that particular papercut at all anymore? >> >> -many >> >> It's also not a path I want to add any unnecessary instructions to. > > Okay, but I'd be curious to know how widespread this position is. This was recently (as in: I still remember it) discussed: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com Probably not worth opening up again. But it seems to me that the pfree() in fe_memutils.c should Assert(pointer != NULL), to be consistent with the backend version. I've also been thinking sometimes about a pfree_if_nonnull() (which would do { if (ptr) pfree(ptr)) }. That would in some cases make the notation more compact and robust. Maybe it could help here too?