[Bug libstdc++/17215] New: __basic_file<char>::close ignores errors
ken at xorian dot net
gcc-bugzilla@gcc.gnu.org
Fri Aug 27 18:04:00 GMT 2004
__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
More information about the Gcc-bugs
mailing list