Re: Collection of memory leaks for ECPG driver

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Collection of memory leaks for ECPG driver
Дата
Msg-id 4940.1434168160@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Collection of memory leaks for ECPG driver  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: Collection of memory leaks for ECPG driver
Список pgsql-hackers
Michael Paquier <michael.paquier@gmail.com> writes:
> On Fri, Jun 12, 2015 at 10:01 PM, Michael Meskes <meskes@postgresql.org> wrote:
>> More seriously, though, does anyone know of any platform where free(NULL) is *not* a noop?

> I recall reading that some past versions of SunOS crashed, but it is
> rather old...

Yeah, SunOS 4.x had issues here, but it's long dead.  More to the point,
both C89 and Single Unix Spec v2 clearly say that free(NULL) is a no-op;
and it's been many years since we agreed that we had no interest in
supporting platforms that didn't meet at least those minimum standards.
So there is no need to worry about any code of ours that does free(NULL).

But having said that, I would not be in a hurry to remove any existing
if-guards for the case.  For one thing, it makes the code look more
similar to backend code that uses palloc/pfree, where we do *not* allow
pfree(NULL).  There's also the point that changing longstanding code
creates back-patching hazards, so unless there's a clear gain it's best
not to.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Time to fully remove heap_formtuple() and friends?
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Time to fully remove heap_formtuple() and friends?