Backout of '29b3ae5d9a50: Fixed memory leak that happened each time a llif-/llofstream was constructed and had open() called. (Windows only).' This will lead to llxfstream leaking a std::locale (4 byte as of now) each time _Myios::init init is called in ::open. But without calling ::_Init in the ctor, the dtor will crash if ::_Init was never called. So living with the leak for now.

Nicky 2012-05-21 14:58:17 +02:00
parent 91d6bb7cdd
commit 7cc55e9bcf
2 changed files with 6 additions and 12 deletions

View File

@ -291,8 +291,7 @@ llifstream::~llifstream()
llifstream::llifstream(const std::string& _Filename,
ios_base::openmode _Mode,
int _Prot)
// : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
: std::basic_istream< char , std::char_traits< char > >(std::_Noinit),_Filebuffer(NULL),_ShouldClose(false)
: std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
{ // construct with named file and specified mode
open(_Filename, _Mode | ios_base::in, _Prot); /* Flawfinder: ignore */
@ -342,8 +341,7 @@ void llofstream::close()
llofstream::llofstream(const std::string& _Filename,
std::ios_base::openmode _Mode,
int _Prot)
// : std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
: std::basic_ostream<char,std::char_traits < char > >(std::_Noinit,true),_Filebuffer(NULL),_ShouldClose(false)
: std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
{ // construct with named file and specified mode
open(_Filename, _Mode , _Prot); /* Flawfinder: ignore */
}

View File

@ -100,8 +100,7 @@ public:
typedef std::basic_ios<char,std::char_traits< char > > _Myios;
llifstream()
// : std::basic_istream<char,std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
: std::basic_istream<char,std::char_traits< char > >(std::_Noinit),_Filebuffer(NULL),_ShouldClose(false)
: std::basic_istream<char,std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
{ // construct unopened
}
@ -110,8 +109,7 @@ public:
int _Prot = (int)ios_base::_Openprot);
explicit llifstream(_Filet *_File)
// : std::basic_istream<char,std::char_traits< char > >(NULL,true),
: std::basic_istream<char,std::char_traits< char > >(std::_Noinit),
: std::basic_istream<char,std::char_traits< char > >(NULL,true),
_Filebuffer(new _Myfb(_File)),
_ShouldClose(false)
{ // construct with specified C stream
@ -142,8 +140,7 @@ public:
typedef std::basic_ios<char,std::char_traits < char > > _Myios;
llofstream()
// : std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
: std::basic_ostream<char,std::char_traits < char > >(std::_Noinit,true),_Filebuffer(NULL),_ShouldClose(false)
: std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
{ // construct unopened
}
@ -153,8 +150,7 @@ public:
explicit llofstream(_Filet *_File)
// : std::basic_ostream<char,std::char_traits < char > >(NULL,true),
: std::basic_ostream<char,std::char_traits < char > >(std::_Noinit,true),
: std::basic_ostream<char,std::char_traits < char > >(NULL,true),
_Filebuffer(new _Myfb(_File)),//_File)
_ShouldClose(false)
{ // construct with specified C stream