public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/17215] New: __basic_file<char>::close ignores errors
@ 2004-08-27 18:04 ken at xorian dot net
  2004-08-27 18:07 ` [Bug libstdc++/17215] " ken at xorian dot net
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ken at xorian dot net @ 2004-08-27 18:04 UTC (permalink / raw)
  To: gcc-bugs

__basic_file<char>::close ignores the return value of fclose(3).  This
call can fail and set errno to a variety of values (ENOSPC, EINTR,
etc.).  Aside from not notifying the client code (e.g. by setting
failbit in an enclosing fstream), this can also cause a memory leak as
the FILE data structure won't be de-allocated by a failed fclose and
__basic_file<char>::close discards it regardless.

Similarly, in the case where _M_cfile_created is false,
__basic_file<char>::close ignores the return value of this->sync(),
which is just a call to fflush(3).  This is not quite as bad (as it
can't cause a memory leak), but is still arguably wrong.

-- 
           Summary: __basic_file<char>::close ignores errors
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ken at xorian dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17215


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-11-08  0:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-27 18:04 [Bug libstdc++/17215] New: __basic_file<char>::close ignores errors ken at xorian dot net
2004-08-27 18:07 ` [Bug libstdc++/17215] " ken at xorian dot net
2004-08-27 19:25 ` pcarlini at suse dot de
2004-08-27 22:49 ` ken at xorian dot net
2004-08-28 18:32 ` pcarlini at suse dot de
2004-08-30 11:34 ` cvs-commit at gcc dot gnu dot org
2004-08-30 11:35 ` pcarlini at suse dot de
2004-09-02 17:41 ` [Bug libstdc++/17215] [3.4 only] " bkoz at gcc dot gnu dot org
2004-09-02 18:09 ` ken at xorian dot net
2004-11-01  0:45 ` mmitchel at gcc dot gnu dot org
2004-11-08  0:41 ` cvs-commit at gcc dot gnu dot org
2004-11-08  0:42 ` pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).