[Scummvm-git-logs] scummvm master -> 76b61e398e811cdfb56089c64bede791baf2ccee

antoniou79 noreply at scummvm.org
Sat Dec 7 19:20:21 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
76b61e398e BLADERUNNER: Don't allocate the thumbnail before needing it


Commit: 76b61e398e811cdfb56089c64bede791baf2ccee
    https://github.com/scummvm/scummvm/commit/76b61e398e811cdfb56089c64bede791baf2ccee
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-07T21:20:18+02:00

Commit Message:
BLADERUNNER: Don't allocate the thumbnail before needing it

Graphics::loadThumbnail will overwrite it and it creates a memory leak.

Changed paths:
    engines/bladerunner/savefile.cpp


diff --git a/engines/bladerunner/savefile.cpp b/engines/bladerunner/savefile.cpp
index 04d40d679b7..5a10db6b643 100644
--- a/engines/bladerunner/savefile.cpp
+++ b/engines/bladerunner/savefile.cpp
@@ -147,8 +147,6 @@ bool SaveFileManager::readHeader(Common::SeekableReadStream &in, SaveFileHeader
 	}
 
 	if (!skipThumbnail) {
-		header._thumbnail = new Graphics::Surface(); // freed by ScummVM's smartptr
-
 		s.skip(4); //skip size;
 
 		if (header._version >= 4) {
@@ -160,6 +158,7 @@ bool SaveFileManager::readHeader(Common::SeekableReadStream &in, SaveFileHeader
 				thumbnailData[i] = s.readUint16LE() | alphamask; // We set all pixels to non-transparency
 			}
 
+			header._thumbnail = new Graphics::Surface(); // freed by ScummVM's smartptr
 			header._thumbnail->init(80, 60, 160, thumbnailData, gameDataPixelFormat());
 		}
 




More information about the Scummvm-git-logs mailing list