[Scummvm-git-logs] scummvm master -> 16a47a56ce9c0cddb65b26fd65f556e4c3f1d678

sev- noreply at scummvm.org
Fri Apr 7 09:01:25 UTC 2023


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:
16a47a56ce DIRECTOR: Plug memory leak


Commit: 16a47a56ce9c0cddb65b26fd65f556e4c3f1d678
    https://github.com/scummvm/scummvm/commit/16a47a56ce9c0cddb65b26fd65f556e4c3f1d678
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-04-07T11:01:15+02:00

Commit Message:
DIRECTOR: Plug memory leak

Changed paths:
    engines/director/score.cpp


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index a4184116813..abe778c5f2c 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1119,8 +1119,9 @@ void Score::screenShot() {
 		if (prevbuild > 0) {
 			Common::FSNode fs(filename);
 			Image::PNGDecoder decoder;
+			Common::SeekableReadStream *stream = fs.createReadStream();
 
-			if (decoder.loadStream(*fs.createReadStream())) {
+			if (decoder.loadStream(*stream)) {
 				Common::String oldMd5 = computeSurfaceMd5(decoder.getSurface());
 				Common::String newMd5 = computeSurfaceMd5(newSurface);
 
@@ -1128,12 +1129,15 @@ void Score::screenShot() {
 					warning("Screenshot is equal to previous one, skipping: %s", filename.c_str());
 					newSurface->free();
 					delete newSurface;
+					delete stream;
 
 					return;
 				}
 			} else {
 				warning("Error loading previous screenshot %s", filename.c_str());
 			}
+
+			delete stream;
 		}
 	}
 




More information about the Scummvm-git-logs mailing list