Maintained by: NLnet Labs

NULL-checks before free()

Tony Finch
Thu Dec 10 11:23:53 CET 2015


Michael McConville via Unbound-users <unbound-users at unbound.net> wrote:
>
> POSIX specifies that free() is NULL-safe. All modern and almost all
> prehistoric platforms conform to this, and most codebases already assume
> it.

free() has been NULL-safe since C89. (Allocators were not very standard
before then so I would expect 1980s pre-standard free() to behave
weirdly.)

Tony.
-- 
f.anthony.n.finch  <dot at dotat.at>  http://dotat.at/
Trafalgar: Easterly 4 or 5, but 6 to gale 8 in southeast. Moderate or rough.
Fair. Moderate or good.