diff --git a/code/nel/include/nel/misc/big_file.h b/code/nel/include/nel/misc/big_file.h index 14851d69e..95fc09b41 100644 --- a/code/nel/include/nel/misc/big_file.h +++ b/code/nel/include/nel/misc/big_file.h @@ -112,7 +112,8 @@ public: // A BNP structure struct BNP { - BNP() : FileNames(NULL), ThreadFileId(0), CacheFileOnOpen(false), AlwaysOpened(false), InternalUse(false), OffsetFromBeginning(0) { } + BNP(); + ~BNP(); // FileName of the BNP. important to open it in getFile() (for other threads or if not always opened). std::string BigFileName; @@ -163,6 +164,7 @@ private: { public: CThreadFileArray(); + ~CThreadFileArray(); // Allocate a FileId for a BNP. uint32 allocate(); diff --git a/code/nel/src/misc/big_file.cpp b/code/nel/src/misc/big_file.cpp index a458b602d..fc247b07b 100644 --- a/code/nel/src/misc/big_file.cpp +++ b/code/nel/src/misc/big_file.cpp @@ -45,8 +45,16 @@ void CBigFile::releaseInstance() // *************************************************************************** CBigFile::CThreadFileArray::CThreadFileArray() { - _CurrentId= 0; + _CurrentId = 0; } + +// *************************************************************************** +CBigFile::CThreadFileArray::~CThreadFileArray() +{ + vector *ptr = (vector*)_TDS.getPointer(); + if (ptr) delete ptr; +} + // *************************************************************************** uint32 CBigFile::CThreadFileArray::allocate() { @@ -186,11 +194,24 @@ void CBigFile::remove (const std::string &sBigFileName) fclose (handle.File); handle.File= NULL; } - delete [] rbnp.FileNames; + _BNPs.erase (it); } } +CBigFile::BNP::BNP() : FileNames(NULL), ThreadFileId(0), CacheFileOnOpen(false), AlwaysOpened(false), InternalUse(false), OffsetFromBeginning(0) +{ +} + +CBigFile::BNP::~BNP() +{ + if (FileNames) + { + delete[] FileNames; + FileNames = NULL; + } +} + //// *************************************************************************** bool CBigFile::BNP::readHeader() {