Safe coding practices

Doug Gwyn gwyn at smoke.brl.mil
Sat Jan 26 03:53:57 AEST 1991


In article <22311:Jan2502:34:1191 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>... there's no safe way to use realloc() ...

In Standard C realloc() is required to be safe.  Of course it may return
NULL even if you're attempting to shrink the allocation, although it is
unlikely that an implementation would be so deficient.

The relevant point is that one should be prepared to deal with realloc()
failure, not blindly assume it will always work.



More information about the Comp.bugs.4bsd.ucb-fixes mailing list