Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Feb 2004 00:13:00 -0800
From:      Tim Kientzle <tim@kientzle.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        current@freebsd.org
Subject:   Re: standard error handling for malloc() broken for user root and group wheel
Message-ID:  <4034700C.9090107@kientzle.com>
In-Reply-To: <20040219121708.U23382@gamplex.bde.org>
References:  <9567.1077094252@critter.freebsd.dk> <20040219121708.U23382@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 18 Feb 2004, Poul-Henning Kamp wrote:
>
>The situations which can result in the 'a' vs 'A' flag making a
>difference in malloc(3) behavior are all violations of the malloc(3)
>API as defined by ISO C and as such the standard defines the behaviour
>as "undefined".

ANSI/ISO 9899-1990, Section 7.10.3.3 clearly states:

    "The malloc function returns either a null pointer
     or a pointer to the allocated space."

There are no "undefined" possibilities here.  Aborting the program
on a failure to allocate memory is pretty clearly a violation
of the standard, which requires the malloc function to
always return.

Tim Kientzle



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4034700C.9090107>