aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/save/saveload_v4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob/save/saveload_v4.cpp')
-rw-r--r--engines/gob/save/saveload_v4.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/engines/gob/save/saveload_v4.cpp b/engines/gob/save/saveload_v4.cpp
index e73b745aae..d626c71ad4 100644
--- a/engines/gob/save/saveload_v4.cpp
+++ b/engines/gob/save/saveload_v4.cpp
@@ -317,9 +317,9 @@ bool SaveLoad_v4::GameHandler::createReader(int slot) {
return (_reader != 0);
if (!_reader || (_reader->getSlot() != ((uint32) slot))) {
- char *slotFile = _slotFile->build(slot);
+ Common::String slotFile = _slotFile->build(slot);
- if (!slotFile)
+ if (slotFile.empty())
return false;
delete _reader;
@@ -328,7 +328,6 @@ bool SaveLoad_v4::GameHandler::createReader(int slot) {
if (converter.isOldSave()) {
// Old save, plug the converter in
if (!converter.load()) {
- delete[] slotFile;
return false;
}
@@ -337,8 +336,6 @@ bool SaveLoad_v4::GameHandler::createReader(int slot) {
} else
_reader = new SaveReader(3, slot, slotFile);
- delete[] slotFile;
-
if (!_reader->load()) {
delete _reader;
_reader = 0;
@@ -355,15 +352,13 @@ bool SaveLoad_v4::GameHandler::createWriter(int slot) {
return (_writer != 0);
if (!_writer || (_writer->getSlot() != ((uint32) slot))) {
- char *slotFile = _slotFile->build(slot);
+ Common::String slotFile = _slotFile->build(slot);
- if (!slotFile)
+ if (slotFile.empty())
return false;
delete _writer;
_writer = new SaveWriter(3, slot, slotFile);
-
- delete[] slotFile;
}
return true;