Re: Why pfree(NULL) breaks execution?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Marios Vodas <mvodas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why pfree(NULL) breaks execution?
Date: 2011-03-04 14:50:11
Message-ID: AANLkTi=hpBiVdyaFayuvd250ibpZoT8eih58UG7t9cu=@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 4, 2011 at 8:08 AM, Marios Vodas <mvodas(at)gmail(dot)com> wrote:
> C doesn't break on free(NULL) so why is pfree developed to break on NULL?
> Is there any way in PostgreSQL to overcome this so that it won't break,
> apart from checking if the pointer NULL?

I think that free(NULL) works on some platforms but not all. I don't
see what advantage we'd get out of making pfree(NULL) silently work,
and there's a clear disadvantage: it would remove a useful sanity
check.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2011-03-04 15:04:30 Re: Why pfree(NULL) breaks execution?
Previous Message Magnus Hagander 2011-03-04 14:25:10 Re: pg_basebackup and wal streaming