Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioeM0-0003K5-P8 for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Jan 2020 02:12:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ioeLx-0008IT-8c for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Jan 2020 02:12:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioeLx-0008IM-0C for pgsql-bugs@lists.postgresql.org; Tue, 07 Jan 2020 02:12:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ioeLq-0001nY-JN for pgsql-bugs@lists.postgresql.org; Tue, 07 Jan 2020 02:12:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 0072C5c8007985; Mon, 6 Jan 2020 21:12:05 -0500 From: Tom Lane To: Michael Paquier cc: Andres Freund , starbugs@qq.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16190: The usage of NULL pointer in refint.c In-reply-to: <20200107012741.GD2386@paquier.xyz> References: <16190-70181c803641c3dc@postgresql.org> <20200106051800.GL3598@paquier.xyz> <1234.1578291695@sss.pgh.pa.us> <20200106174443.3pwnmshbxrbwggrm@alap3.anarazel.de> <20200107012741.GD2386@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Tue, 07 Jan 2020 10:27:41 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7983.1578363125.1@sss.pgh.pa.us> Date: Mon, 06 Jan 2020 21:12:05 -0500 Message-ID: <7984.1578363125@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Mon, Jan 06, 2020 at 09:44:43AM -0800, Andres Freund wrote: >> I think we should consider either moving this out of contrib, or fixing >> it up. test/example code is fine, but contrib gets installed by default >> for a lot of people... And yea, this isn't just about contrib/spi. > No idea about moving that out of contrib/, but here is a patch to fix > things that just moves the allocations to TopMemoryContext and removes > the system calls. WFM. There are probably more elegant ways to do it than to drop this stuff into TopMemoryContext, but this is surely better than unchecked malloc calls. regards, tom lane