Xref: utzoo comp.std.c:1889 comp.lang.c:23062 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!udel!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c,comp.lang.c Subject: Re: Common malloc/free practice violates ANSI standard ? Message-ID: <11350@smoke.BRL.MIL> Date: 20 Oct 89 13:27:50 GMT References: <1989Oct14.043811.669@anucsd.oz> <646@targon.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Followup-To: comp.std.c Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 14 In article <646@targon.UUCP> andre@targon.UUCP (andre) writes: >The fact that you conclude that the pointer can be changed in value >when cast from void * to * is wrong, because free() could never >know what pointer you used and thus howmany bytes back it much go to >find the pionters of the free list that probably precede your buffer. This refutation is wrong -- under the (INCORRECT) assumption that the original malloc()ed pointer has been rounded up by conversion to an object pointer, free() could still locate the correct chunk of memory to liberate, under certain reasonable implementation assumptions. However, an error in the refutation does not prove the original claim, which was mistaken all along.