Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bejJg-0004Gs-NN for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Aug 2016 13:43:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bejJg-0007Az-4F for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Aug 2016 13:43:04 +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.84_2) (envelope-from ) id 1bejJe-0007AJ-SL for pgsql-hackers@postgresql.org; Tue, 30 Aug 2016 13:43:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bejJZ-0004US-6j for pgsql-hackers@postgresql.org; Tue, 30 Aug 2016 13:43:01 +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 u7UDgj14026291; Tue, 30 Aug 2016 09:42:45 -0400 From: Tom Lane To: Aleksander Alekseev cc: Michael Paquier , Heikki Linnakangas , PostgreSQL mailing lists Subject: Re: Missing checks when malloc returns NULL... In-reply-to: <20160830133048.GA84635@e733> References: <7978.1466516782@sss.pgh.pa.us> <20160829130513.GA8340@e733> <20160829141315.GB8340@e733> <24843.1472563085@sss.pgh.pa.us> <20160830133048.GA84635@e733> Comments: In-reply-to Aleksander Alekseev message dated "Tue, 30 Aug 2016 16:30:49 +0300" Date: Tue, 30 Aug 2016 09:42:45 -0400 Message-ID: <26290.1472564565@sss.pgh.pa.us> X-Pg-Spam-Score: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Aleksander Alekseev writes: > I suggest to keep ShmemAlloc as is for backward compatibility and > introduce a new procedure ShmemAllocSafe. I think that's about the worst of all possible worlds, as it guarantees having to touch most call sites. If there were more than one known caller that really wanted the return-NULL behavior, exact backwards compatibility might carry the day; but as things stand I think the odds are that most call sites need an error check and probably have not got one. I'd rather err in favor of "safe by default" than "backwards compatible". regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers