Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucsd!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: What happens when realloc() returns NULL? Message-ID: <10898@smoke.BRL.MIL> Date: 31 Aug 89 23:04:33 GMT References: <1103@virtech.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 12 In article <1103@virtech.UUCP> cpcahil@virtech.UUCP (Conor P. Cahill) writes: >System V Rel 2.x: When this happens the block pointed to by ptr may > be destroyed. The SVID Issue 2 does not permit that, though, and SVR2.0 in fact does not overwrite the storage. However, the block at ptr is marked as being free, which makes it tricky to recover, since any further use of malloc() or realloc() might step on the freed data. Although the C Standard is not crystal-clear on this point, the intent is that the block is supposed to still be allocated. This was (correctly) noted as a "BUG" in some manual pages.