diff --git a/common/file.cpp b/common/file.cpp index 6320838e0b5..0d760cb5094 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -162,8 +162,12 @@ bool DumpFile::open(const String &filename, bool createPath) { subpath.erase(i); if (subpath.empty()) continue; AbstractFSNode *node = g_system->getFilesystemFactory()->makeFileNodePath(subpath); - if (node->exists()) continue; + if (node->exists()) { + delete node; + continue; + } if (!node->create(true)) warning("DumpFile: unable to create directories from path prefix"); + delete node; } } }