diff --git a/src/common/filesystem/source/filesystem.cpp b/src/common/filesystem/source/filesystem.cpp index 8e86b51d0..c22682ec0 100644 --- a/src/common/filesystem/source/filesystem.cpp +++ b/src/common/filesystem/source/filesystem.cpp @@ -194,7 +194,7 @@ static void PrintLastError (FileSystemMessageFunc Printf); FileSystem::FileSystem() { - stringpool = new StringPool; + stringpool = new StringPool(true); stringpool->shared = true; // will be used by all owned resource files. } @@ -219,6 +219,8 @@ void FileSystem::DeleteAll () delete Files[i]; } Files.clear(); + delete stringpool; + stringpool = nullptr; } //========================================================================== diff --git a/src/common/filesystem/source/fs_stringpool.h b/src/common/filesystem/source/fs_stringpool.h index f72a180df..3472cd792 100644 --- a/src/common/filesystem/source/fs_stringpool.h +++ b/src/common/filesystem/source/fs_stringpool.h @@ -8,7 +8,7 @@ class StringPool friend class FileSystem; friend class FResourceFile; private: - StringPool(size_t blocksize = 10*1024) : TopBlock(nullptr), FreeBlocks(nullptr), BlockSize(blocksize) {} + StringPool(bool _shared, size_t blocksize = 10*1024) : TopBlock(nullptr), FreeBlocks(nullptr), BlockSize(blocksize), shared(_shared) {} public: ~StringPool(); const char* Strdup(const char*); diff --git a/src/common/filesystem/source/resourcefile.cpp b/src/common/filesystem/source/resourcefile.cpp index 079998df9..c86d4e11f 100644 --- a/src/common/filesystem/source/resourcefile.cpp +++ b/src/common/filesystem/source/resourcefile.cpp @@ -332,7 +332,7 @@ FResourceFile *FResourceFile::OpenDirectory(const char *filename, LumpFilterInfo FResourceFile::FResourceFile(const char *filename, StringPool* sp) { - stringpool = sp ? sp : new StringPool; + stringpool = sp ? sp : new StringPool(false); FileName = stringpool->Strdup(filename); }