Re: Missing checks when malloc returns NULL... - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Missing checks when malloc returns NULL...
Date
Msg-id 26290.1472564565@sss.pgh.pa.us
Whole thread Raw
In response to Re: Missing checks when malloc returns NULL...  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
List pgsql-hackers
Aleksander Alekseev <a.alekseev@postgrespro.ru> 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Missing checks when malloc returns NULL...
Next
From: Tom Lane
Date:
Subject: Re: standalone backend PANICs during recovery