home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!oracle!unrepliable!bounce
- Newsgroups: comp.lang.c
- From: wkaufman@us.oracle.com (William Kaufman)
- Subject: Re: Pointers to freed memory
- Message-ID: <1992Jul31.035905.20683@oracle.us.oracle.com>
- Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
- Nntp-Posting-Host: hqsun2.us.oracle.com
- Organization: Oracle Corporation, Redwood Shores CA
- References: <1992Jul29.205834.11308@hubcap.clemson.edu> <3179@dozo.and.nl> <1992Jul30.164035.7349@taumet.com>
- Date: Fri, 31 Jul 1992 03:59:05 GMT
- X-Disclaimer: This message was written by an unauthenticated user
- at Oracle Corporation. The opinions expressed are those
- of the user and not necessarily those of Oracle.
- Lines: 29
-
- Sorry to post asking for random machine specifics, but this one
- intrigued me. If what Steve says is true, there's a whole lot of busted
- code out there,...some of it with my name on it,...
-
- In article <1992Jul30.164035.7349@taumet.com> steve@taumet.com (Steve Clamage) writes:
- ]
- ] The C Standard states that the value of the pointer after a call to free
- ] is 'indeterminate'. This means that just reading the value might
- ] produce a runtime fault.
-
- Well, OK, the pointer will be useless, but will it really be
- dangerous? What he's got is essentially:
-
- struct something *p = (struct something *)rand();
-
- Could this assignment really cause a fault? Even if p is never
- dereferenced? I know this is an improper question, but what machines is
- this true for?
-
- I can't count the times that I've freed a circular list the way the
- original poster did--save the old "next" pointer, free this one, move on
- to the saved "next". If what you say is true, you'd have to stop at
- one-before-the-end and free that one without checking the next pointer.
-
- -- Bill K.
-
- Bill Kaufman, | "...all conscious species are plastic and
- Corporate Lackey | all plastic species are conscious."
- wkaufman@us.oracle.com | -- Yew-Kwang Ng
-