aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2017-09-20 07:10:08 +0200
committerBastien Bouclet2017-09-20 07:12:09 +0200
commit56b744f5f15e15c01fbd89db88a595d95f1c71cb (patch)
treeb08f1ade3d3576d03d281b2d7ccaf93cc2d7c2eb
parent37d0b401cb751ac2cb907ec2169ab1ef288c032d (diff)
downloadscummvm-rg350-56b744f5f15e15c01fbd89db88a595d95f1c71cb.tar.gz
scummvm-rg350-56b744f5f15e15c01fbd89db88a595d95f1c71cb.tar.bz2
scummvm-rg350-56b744f5f15e15c01fbd89db88a595d95f1c71cb.zip
MOHAWK: Riven: Plug memory leak when saving
Fixes #10216.
-rw-r--r--engines/mohawk/riven_saveload.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp
index 808eff6aa9..7165166d8f 100644
--- a/engines/mohawk/riven_saveload.cpp
+++ b/engines/mohawk/riven_saveload.cpp
@@ -287,7 +287,7 @@ Common::Error RivenSaveLoad::loadGame(const int slot) {
}
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() {
- Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
+ Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
if (_vm->getFeatures() & GF_DVD)
stream->writeUint32BE(kDVDSaveGameVersion);
else
@@ -296,7 +296,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() {
}
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVARSSection() {
- Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
+ Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
for (RivenVariableMap::const_iterator it = _vm->_vars.begin(); it != _vm->_vars.end(); it++) {
stream->writeUint32BE(1); // Reference counter
@@ -312,7 +312,7 @@ static int stringCompareToIgnoreCase(const Common::String &s1, const Common::Str
}
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genNAMESection() {
- Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
+ Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
stream->writeUint16BE(_vm->_vars.size());
@@ -354,7 +354,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genNAMESection() {
}
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() {
- Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
+ Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
stream->writeUint16BE(_vm->_zipModeData.size());
@@ -368,7 +368,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() {
}
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genTHMBSection() const {
- Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
+ Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
Graphics::saveThumbnail(*stream);
@@ -376,7 +376,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genTHMBSection() const {
}
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genMETASection(const Common::String &desc) const {
- Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
+ Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
Common::Serializer serializer = Common::Serializer(nullptr, stream);
TimeDate t;