Article View: comp.std.c
Article #680free behavior (was: Re: Out-of-bounds pointers)
From: John F. Haugh II
Date: Tue, 10 Oct 1989 05:58
Date: Tue, 10 Oct 1989 05:58
20 lines
1673 bytes
1673 bytes
In article <11234@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes:
>NO NO NO. You have mispresented the argument. So long as malloc()
>(assumed to be properly declared!) doesn't return a null pointer,
>the above will work in ALL conforming implementations. The trouble
>arises only when after the free() the pointer p (NOT what it points
>to, that's inarguably invalid) continues to be examined or otherwise
>manipulated by the program.
I only bring this up because I've been asleep ...
Doesn't free() insure the pointer remains valid until the next
call to malloc(). This seems to be implied by the statement
that realloc() works if the pointer was used as an argument since
the last call to malloc(). This would seem to imply that for
this to work, the pointer passed to free -must- remain valid.
--
John F. Haugh II +-Things you didn't want to know:------
VoiceNet: (512) 832-8832 Data: -8835 | The real meaning of MACH is ...
InterNet: jfh@rpp386.cactus.org | ... Messages Are Crufty Hacks.
UUCPNet: {texbell|bigtex}!rpp386!jfh +--------------------------------------
Technical Details
Message-ID:
<17119@rpp386.cactus.org>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!texbell!sequoia!rpp386!jfhReferences:
<1009@mtxinu.UUCP> <12570028@hpclwjm.HP.COM> <868@crdos1.crd.ge.COM> <217@bbxsda.UUCP> <11234@smoke.BRL.MIL>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!texbell!sequoia!rpp386!jfh From: jfh@rpp386.cactus.org (John F. Haugh II) Newsgroups: comp.std.c Subject: free behavior (was: Re: Out-of-bounds pointers) Summary: what does free() really do? Message-ID: <17119@rpp386.cactus.org> Date: 10 Oct 89 05:58:47 GMT References: <1009@mtxinu.UUCP> <12570028@hpclwjm.HP.COM> <868@crdos1.crd.ge.COM> <217@bbxsda.UUCP> <11234@smoke.BRL.MIL> Reply-To: jfh@rpp386.cactus.org (John F. Haugh II) Organization: Little or None. Lines: 20