On 6/5/2012 6:19 AM, Zack Weinberg wrote:
On 2012-06-04 8:10 PM, Dave Thompson wrote:
From: owner-openssl-us...@openssl.org On Behalf Of Jakob Bohm

Having no current access to the C89 standard or its
drafts, I am relying on the experience that many "C89"
real world systems I have encountered did not tolerate
free(NULL).  In contrast all recent C++ specifications
(starting with The C++ Programming Language 2nd Ed.
which preceded all published standards), insist that
delete (char*)NULL must be a safe NOP.

C89/90 is hard to find now, but it definitely did specify
free(NULL) is no-op. You say elsethread you may have confused
C89 free() with generally similar calls in OS or perhaps
libraries; those certainly might not be safe for NULL.

According to http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00376.html the last widely-used platform that crashed on free(NULL) was SunOS 4, which "stopped being a reasonable portability target around 2007".

SunOS 4 was noncompliant with C89 in dozens of other ways as well.
Actually, that is not really what it says when read closely.

What it really says is than some guy named "Jim Meyering" believed
(possibly mistakenly) that the free(NULL) issue existed only on
SunOS 4 (he gave no reason for that belief).  On top of that Jim
Meyering may have referring to some political GNU policy of not
wanting to support SunOS 4 as an official porting target (again,
Jim Meyering gave no reason for why SunOS 4 became irrelevant
in 2007).

None of that is really convincing, and the surrounding thread
makes it clear that the gcc patch in question consisted
entirely of overeager "cleanup".

The quotes elsewhere in this discussion have convinced me that
C89 did require free(NULL) to be a NOP, however I have limited
data as to how many platforms implemented that specific
requirement correctly, and prefer to keep guarding my free()
calls just to be safe.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to