Re: standard error handling for malloc() broken for user root and group wheel

From: Tim Kientzle <tim_at_kientzle.com>
Date: Thu, 19 Feb 2004 00:13:00 -0800
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
Received on Wed Feb 18 2004 - 23:13:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:43 UTC