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 1whElF-0005yj-0S for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jul 2026 22:59:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whEkE-003D3x-1C for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jul 2026 22:58:27 +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.96) (envelope-from ) id 1whEkD-003D3o-2V for pgsql-hackers@lists.postgresql.org; Tue, 07 Jul 2026 22:58:26 +0000 Received: from fout-b6-smtp.messagingengine.com ([202.12.124.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1whEkB-000000007WL-1SRJ for pgsql-hackers@postgresql.org; Tue, 07 Jul 2026 22:58:26 +0000 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id 8F2471D0008E; Tue, 7 Jul 2026 18:58:21 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Tue, 07 Jul 2026 18:58:21 -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:subject :subject:to:to; s=fm2; t=1783465101; x=1783551501; bh=bBoIPhEAsj 69IxLxrp19wGCnMOY2eFp5Zd8lhPOYVXY=; b=FU8jUpXYA9lp3MawK5OhUUFDW/ XN26ZUv3b/d+liDCblt7GngNA6nJhP00+NDjmG+VHMvucpI+BukG8gPqG4If0pRr JtPc8TB8P9RZt2CSfF9DAK5KcFnRJMMSusAQ6EIP9tBN98md+neChSVNU8dIe2uG ZHyeWR12w+hg4SBYnCVSrZn1VspC0ojSSIvpQ0or15JZwjA22zG1EfEgKIsSskqw S+NZzW7S5T9Os9urfxX5TnwfcgXZ5T6B33edGfETxfyUzlhlHWPwMCVt/M3GRTz7 igA2TTyLhIz0KmayRWaQUusG01xR6qjrpZveKIkwXObkiRzEFPNbMIF6NgMA== 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:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1783465101; x=1783551501; bh=bBoIPhEAsj69IxLxrp19wGCnMOY2eFp5Zd8 lhPOYVXY=; b=qD8+mAGLwYMbszA6kbuTs77uvybId2B5Zbr3HcWJe7tkhUSOrjw Mmqv+H/rV7mOixX3XGhCMKvUyd6ejay9wa8maaJcF9IiHO7QTwy3BRMUlybeSHL8 TAsQFxLtgVGA+m6FBZwpFlKabMbwIl61X8EYeOSs2qPB5TT+sBnpu57h+nuwCq7Q ucc/urYMm4mcokyVOxHHKjxLQnhvZLH09ofNxpembjGi89fKN+m5kzMq/k/vOJfi DaR/JCKycns6TDeUIkvCSYQ8rpm/TDq8B15/YZAHGGNtrZBBs70LKelDEvnMDtF0 mpJLBj6sNJugZJYmJuxXvq5bcjQFmM6SrbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEmDR4OxFyicye1734OcwBS6KHs26kJfbOS06GtLKmuB0v4+NH9b2WnJG3m8EpIWC Eh6t2DEWVmdgWBAcRefNLNdS0EU4cctro2LnYhOeJh7BsX5iizZTz+/mek16I5p4VHPGMN wleDnmyBaSQexnZ7/vKX8f878s5ze7FPDiqUN26v1AHC/Uwaqd2eATO7T9kZve3TV+Rkwo bwtZfYkAWox8C57Lf+NgVO4oBIhLytVbvok633KpMNjZrqLegdUUmwDMC6E8W65rbatoEk E/5dzlpwr91bbCEAQ4lweeKI6v39UKSBpDR3FYxkohcbVldXg3Rn34qG2QDlC6ATz4nHM7 TlduZs4AJMp430k7cg9dXj8DoN7u1gHNBGVXPUn31OUWlvg56DS4Bwzp9+YjC3uQCB1hDn NENABTZhB3yVQJkKKsddXp0LMA3SEmKJzb/UxdQrfAF4pPtZ/uKUttRy22IAeM3z7RxPFe mah7pJ2DBm5ab3Si2HiY+wi2ltYNPsILZBdWJZn2IJSKv+QFJIVN2bawLonAqtA2oYvU/k LqgDAGvboJ8nTjocJzL4+vHSWfVfX50JBCK4vnfEjqG/Q8yOLFCvaIO8RLRe5YX8d0iCRC Vq93u00MOAVwlUCxGuCOgQMSUQJ0/9qYwpiKKMN04QSFxEraHNUxySSpP90A X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Jul 2026 18:58:19 -0400 (EDT) Date: Wed, 8 Jul 2026 07:58:14 +0900 From: Michael Paquier To: Tom Lane Cc: Peter Eisentraut , Tristan Partin , pgsql-hackers Subject: Re: Add malloc attribute to memory allocation functions Message-ID: References: <924283.1783312014@sss.pgh.pa.us> <2248c1c4-68f7-46dc-9e58-9ba9057da74e@eisentraut.org> <1847455.1783439616@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="M7Kkj7Ku/vbUKbBi" Content-Disposition: inline In-Reply-To: <1847455.1783439616@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --M7Kkj7Ku/vbUKbBi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 07, 2026 at 11:53:36AM -0400, Tom Lane wrote: > There are still places that I'd expect to be trouble. For example, > Coverity has never understood the pattern we use in pg_dump's data > collection subroutines, ie, malloc a big array of structs, fill > the individual structs and insert pointers to them into the hash > tables, done. It always thinks we leaked the array, and I suspect > tools like this will too. In Coverity's case there's enough > infrastructure to dismiss individual false-positive complaints, > and then it won't bug you about them (until somebody changes the > relevant code enough that the dismissal doesn't match :-(). Unless > there's some similar way to silence individual reports, I don't > foresee tools like this to be usable. We're not going to change > coding patterns like that one just because some static analyzer > doesn't understand them. Additional question. Does this help with requirements like the one listed in fe-exec.c for PQfreemem() under WIN32? If the answer to this question is yes, then it would sound like a win for me, we'd had our share of issues in the past where we would use a free() call that interacts with an allocation done in a completely different context library-wise. That's something WIN32 cares a lot about, to mention one place. -- Michael --M7Kkj7Ku/vbUKbBi Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmpNhIYACgkQnvQgOdby QH2Dtg/9HBj1VnbaPrjKRgnBQLrzlD/daRk067/w9P6dTZKJhYyMM5F1mlYGHLB0 NlTJbpqcLGVu84eQSLMA0COUyYXbkxmmuIfQJmaTApiHVfHea4B5gRyazVCPWQeN 2gkhayPmA/pbx/ZhNYy5C+ImxjJ9WKGesKezCz4fjn5DeXRyZJBgvHjBAYJNkvYV Of72pUr33OK6Ofdit6XTYh4RAgfHJ0iGPTswGcnW5akWG3luOSf4yPUjdwMZBIFA acNkJI8dJ6V4/XcANLyWyoO430VI9nMSXJ3E3kqtIKS84iChqlQwWZPUucxeLtml Td9nvIw1+RDjVLP2p+8uaNuWN5GZLZWc0YCvEdl8+MnsIx7b3gBB4ayWQWbSDaGn 40nbpNhJ9w0250vLOtmh3Vv6pNfyYPRyrmNcSFmr5Ax4nPAjEc+D3sCTjLuXOJKP 2TUoYP3EAOP0KwjC/1/aSWxhIOgaBqrM1hiUo/5xHwVCQY/FfWDekmHdNK63q0mB h74yq0BZPBKc8RarG5NzHRLjGnsG56ox9Yj6n7gf60xrNH2D9vD4pCc7+0kIMaDl yitPhRIyZ36yAnXNem9w/PXZQY/c1b47YxGX8bRN7zSFNXhSPRx/70eHlA6c0FKX xXGOacCl5osMJCxekgqKkreF5Sh20CuO9JIph2GAZsw/Pu4bWeg= =YpG+ -----END PGP SIGNATURE----- --M7Kkj7Ku/vbUKbBi--