[Scummvm-git-logs] scummvm master -> 97f9e48eb3e77823c8dac2f70a65ffc753167f7e

sluicebox noreply at scummvm.org
Wed May 8 04:36:18 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:
97f9e48eb3 BAGEL: Fix memory leaks. PVS-Studio V773


Commit: 97f9e48eb3e77823c8dac2f70a65ffc753167f7e
    https://github.com/scummvm/scummvm/commit/97f9e48eb3e77823c8dac2f70a65ffc753167f7e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-05-07T21:31:31-07:00

Commit Message:
BAGEL: Fix memory leaks. PVS-Studio V773

Changed paths:
    engines/bagel/baglib/character_object.cpp
    engines/bagel/spacebar/sraf_computer.cpp


diff --git a/engines/bagel/baglib/character_object.cpp b/engines/bagel/baglib/character_object.cpp
index c24b78198e2..688a4bcb8d0 100644
--- a/engines/bagel/baglib/character_object.cpp
+++ b/engines/bagel/baglib/character_object.cpp
@@ -74,6 +74,7 @@ ErrorCode CBagCharacterObject::attach() {
 	decoder->setSoundType(Audio::Mixer::kSFXSoundType);
 	if (!decoder->loadFile(filename.getBuffer())) {
 		logError(buildString("CHAR SmackOpen failed: %s ", filename.getBuffer()));
+		delete decoder;
 		return ERR_FOPEN;
 	}
 
diff --git a/engines/bagel/spacebar/sraf_computer.cpp b/engines/bagel/spacebar/sraf_computer.cpp
index 9711f45f9cf..319e74a7730 100644
--- a/engines/bagel/spacebar/sraf_computer.cpp
+++ b/engines/bagel/spacebar/sraf_computer.cpp
@@ -4558,12 +4558,11 @@ SrafTextScreen::SrafTextScreen(const CBofString &str, bool isText) :
 		_text = str;
 
 	} else {
-		CBofFile *file = new CBofFile(str, CBF_BINARY | CBF_READONLY);
-		assert(file != nullptr);
+		CBofFile file(str, CBF_BINARY | CBF_READONLY);
 
-		size_t len = file->getLength();
+		size_t len = file.getLength();
 		char *tmp = new char[len + 1];
-		file->read(tmp, len);
+		file.read(tmp, len);
 		tmp[len] = '\0';
 
 		_text = CBofString(tmp);




More information about the Scummvm-git-logs mailing list