From 7cc55e9bcf352f8daa0b7f37d118bc934d2c1ef2 Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 21 May 2012 14:58:17 +0200 Subject: [PATCH] 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. --- indra/llcommon/llfile.cpp | 6 ++---- indra/llcommon/llfile.h | 12 ++++-------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 175222918a..c32a776c3f 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -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 >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) - : std::basic_ostream >(std::_Noinit,true),_Filebuffer(NULL),_ShouldClose(false) + : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) { // construct with named file and specified mode open(_Filename, _Mode , _Prot); /* Flawfinder: ignore */ } diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 77e2fc0586..dd7d36513a 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -100,8 +100,7 @@ public: typedef std::basic_ios > _Myios; llifstream() -// : std::basic_istream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) - : std::basic_istream >(std::_Noinit),_Filebuffer(NULL),_ShouldClose(false) + : std::basic_istream >(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 >(NULL,true), - : std::basic_istream >(std::_Noinit), + : std::basic_istream >(NULL,true), _Filebuffer(new _Myfb(_File)), _ShouldClose(false) { // construct with specified C stream @@ -142,8 +140,7 @@ public: typedef std::basic_ios > _Myios; llofstream() -// : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) - : std::basic_ostream >(std::_Noinit,true),_Filebuffer(NULL),_ShouldClose(false) + : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) { // construct unopened } @@ -153,8 +150,7 @@ public: explicit llofstream(_Filet *_File) -// : std::basic_ostream >(NULL,true), - : std::basic_ostream >(std::_Noinit,true), + : std::basic_ostream >(NULL,true), _Filebuffer(new _Myfb(_File)),//_File) _ShouldClose(false) { // construct with specified C stream