[Scummvm-git-logs] scummvm master -> b5bd7f4beead0a5467bc30b1f11187231b002aa7

lephilousophe lephilousophe at users.noreply.github.com
Sun Feb 16 11:33:05 UTC 2020


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:
b5bd7f4bee CRYOMNI3D: Fix two Coverity issues


Commit: b5bd7f4beead0a5467bc30b1f11187231b002aa7
    https://github.com/scummvm/scummvm/commit/b5bd7f4beead0a5467bc30b1f11187231b002aa7
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2020-02-16T12:32:38+01:00

Commit Message:
CRYOMNI3D: Fix two Coverity issues

- memory leak in loadHLZ when file couldn't be opened (CID 1401735)
- use of out of scope reference (nullptr) when script couldn't be found
    (CID 1401734)

Changed paths:
    engines/cryomni3d/cryomni3d.cpp
    engines/cryomni3d/versailles/engine.cpp


diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp
index 95da49a..a9f102d 100644
--- a/engines/cryomni3d/cryomni3d.cpp
+++ b/engines/cryomni3d/cryomni3d.cpp
@@ -194,8 +194,6 @@ void CryOmni3DEngine::playHNM(const Common::String &filename, Audio::Mixer::Soun
 Image::ImageDecoder *CryOmni3DEngine::loadHLZ(const Common::String &filename) {
 	Common::String fname(prepareFileName(filename, "hlz"));
 
-	Image::ImageDecoder *imageDecoder = new Image::HLZFileDecoder();
-
 	Common::File file;
 
 	if (!file.open(fname)) {
@@ -203,6 +201,8 @@ Image::ImageDecoder *CryOmni3DEngine::loadHLZ(const Common::String &filename) {
 		return nullptr;
 	}
 
+	Image::ImageDecoder *imageDecoder = new Image::HLZFileDecoder();
+
 	if (!imageDecoder->loadStream(file)) {
 		warning("Failed to open hlz file %s", fname.c_str());
 		delete imageDecoder;
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index f8bff45..1137b81 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -1513,7 +1513,7 @@ void CryOmni3DEngine_Versailles::executeSeeAction(uint actionId) {
 		return;
 	}
 
-	const FixedImgCallback &cb = _imgScripts.getVal(actionId, nullptr);
+	const FixedImgCallback cb = _imgScripts.getVal(actionId, nullptr);
 	if (cb != nullptr) {
 		handleFixedImg(cb);
 	} else {




More information about the Scummvm-git-logs mailing list