[net.unix-wizards] Realloc which works when it returns 0

mbr (02/28/83)

Any of you who actually check for 0 return codes from malloc() and
realloc(), (i.e. not enough memory) may have noticed the following
caveat in the manual:

BUGS
     When realloc returns 0, the block pointed to by ptr may be
     destroyed.

The situation is actually worse than that.  If malloc() ever returns
0, it may leave one of its internal pointers (allocp) with a value which
will cause malloc() to crash the next time it is called.  I have posted
a fix to net.sources.  This also includes much more flexible debugging
options than the original.

		...!fortune!mbr
		Fortune Systems Corp.
		Mark Rosenthal