🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1310

Re: fclose() messes up heap

#1310
From: ~{QG9p~}
Date: Sun, 06 Sep 1992 18:38
17 lines
1262 bytes
In article <1992Sep3.210532.22036@tc.cornell.edu> elan@tasha.cheme.cornell.edu (Elan Feingold) writes:
>
>In a program I'm writing, after I fclose() a file, it seems to mess up the free space of the core, and I'm really not sure why.  It seems that this sequence of events messes up the memory.
>
>1. Open file
>2. Allocate and deallocate memory
>3. Close file

Not sure if this is the case here, but doing "fclose" after an "open",
or a "close" after a "fopen" frequently crash the system with some 
compilers. It's a good idea to get into a habit of always using one
pair and never the other.

Also closing a NULL file ptr (probably after a failed open) could
be problematic as well.

 Ya-Gui Wei
Technical Details
Message-ID: <Bu66FI.Drp@usenet.ucs.indiana.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!usenet.ucs.indiana.edu!bronze.ucs.indiana.edu!yawei
References: <1992Sep3.210532.22036@tc.cornell.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!usenet.ucs.indiana.edu!bronze.ucs.indiana.edu!yawei
From: yawei@bronze.ucs.indiana.edu (~{QG9p~})
Subject: Re: fclose() messes up heap
Message-ID: <Bu66FI.Drp@usenet.ucs.indiana.edu>
Sender: news@usenet.ucs.indiana.edu (USENET News System)
Nntp-Posting-Host: bronze.ucs.indiana.edu
Organization: Indiana University
References: <1992Sep3.210532.22036@tc.cornell.edu>
Date: Sun, 6 Sep 1992 18:38:05 GMT
Lines: 19