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)
This commit is contained in:
Le Philousophe 2020-02-16 12:29:24 +01:00
parent ba147f5ad5
commit b5bd7f4bee
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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 {