realloc() (was: Re: Safe coding practices)
Mark Moraes
moraes at cs.toronto.edu
Sun Feb 3 09:03:56 AEST 1991
>From the Seventh Edition manual page for malloc(3):
> BUGS
> When realloc returns 0, the block pointed to by ptr may be
> destroyed.
[This exists in the Eighth and Tenth Edition manuals as well, also
the 4.3Reno manuals]
So one can't portably rely on the contents of the block being
realloced if the realloc failed. On the other hand, this behaviour is
clearly marked a bug as far back as V7.
Mark.
More information about the Comp.lang.c
mailing list