From 9c2cfee4e53f5e678d37b33cdcb354782932b10c Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Wed, 20 Sep 2017 19:20:14 +0200 Subject: SWORD25: Fix leaking the save thumbnail MemoryWriteStreamDynamic --- engines/sword25/gfx/screenshot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp index eeaece97f2..c86a2fe1d5 100644 --- a/engines/sword25/gfx/screenshot.cpp +++ b/engines/sword25/gfx/screenshot.cpp @@ -113,11 +113,11 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data) } // Create a PNG representation of the thumbnail data - Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(); - saveToFile(&thumbnail, stream); + Common::MemoryWriteStreamDynamic stream(DisposeAfterUse::NO); + saveToFile(&thumbnail, &stream); // Output a MemoryReadStream that encompasses the written data - Common::SeekableReadStream *result = new Common::MemoryReadStream(stream->getData(), stream->size(), + Common::SeekableReadStream *result = new Common::MemoryReadStream(stream.getData(), stream.size(), DisposeAfterUse::YES); return result; } -- cgit v1.2.3