home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20126 < prev    next >
Encoding:
Text File  |  1993-01-24  |  1.2 KB  |  34 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!emba-news.uvm.edu!griffin!ertle
  3. From: ertle@kira.uvm.edu The Sneaky Devil
  4. Subject: Re: Btree, or Linked List Questions
  5. Message-ID: <ertle.727827257@griffin>
  6. Sender: news@uvm.edu
  7. Organization: University of Vermont -- Division of EMBA Computer Facility
  8. References: <C13soz.73L@murphy.com> <1993Jan21.015358.24137@g2syd.genasys.com.au> <1993Jan23.182957.25180@scorch.apana.org.au>
  9. Distribution: default
  10. Date: Sat, 23 Jan 1993 22:14:17 GMT
  11. Lines: 21
  12.  
  13. In <1993Jan23.182957.25180@scorch.apana.org.au> harris@scorch.apana.org.au (Michael Brown) writes:
  14.  
  15.  
  16. >    for(;(temp_ptr=head_ptr)!=NULL;free(temp_ptr)) head_ptr=head_ptr->next;
  17. >    
  18.  
  19. This looks bogus to me.  temp_ptr points to what head_ptr points to.
  20. Then you free what temp_ptr points to, leaving it and head_ptr
  21. pointing at nothing.  Then you try to access what head_ptr points at.
  22.  
  23.    Your "C" package/operating system might not use the freed memory
  24. immediately, so this might work, but I don't think that you can count
  25. on it being portable.
  26.  
  27.  
  28.  
  29. --
  30. James A. Ertle                       |Don't be such a guppy!!
  31. ertle@{hal|sal|kira|griffin}.uvm.edu |
  32. UVM's EMBA Computer Facility         |         -Ariel
  33. Burlington, Vt. USA                  |
  34.