Path: utzoo!utgpu!news-server.csri.toronto.edu!smoke.cs.toronto.edu!moraes Newsgroups: comp.lang.c From: moraes@cs.toronto.edu (Mark Moraes) Subject: Re: realloc() (was: Re: Safe coding practices) Message-ID: <91Feb2.170338edt.577@smoke.cs.toronto.edu> Organization: Department of Computer Science, University of Toronto References: <23975:Jan2516:36:5891@kramden.acf.nyu.edu> <1991Jan30.121425.16882@unhd.unh.edu> <1991Jan30.193308.3897@athena.mit.edu> <1991Jan30.204210.5593@thyme.jpl.nasa.gov> Date: 2 Feb 91 22:03:56 GMT Lines: 13 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.