What happens when realloc() returns NULL?

Conor P. Cahill cpcahil at virtech.UUCP
Fri Sep 1 02:42:35 AEST 1989


In article <TOM.89Aug30231415 at yang.cpac.washington.edu>, tom at yang.cpac.washington.edu (Tom May) writes:
> and malloc() returns non-NULL, but realloc() returns NULL, is the memory
> pointed to by p1 still allocated?

This is yet another one of those RTFMs.  The malloc page (under
the DIAGNOSTICS section) clearly states the following:

System V Rel 3.x:	When realloc returns NULL, the block pointed to by
       &		ptr is left intact.
SCO Xenix 2.3.2


System V Rel 2.x:	When this happens the block pointed to by ptr may
       			be destroyed.

-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.lang.c mailing list