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

athrxx noreply at scummvm.org
Sat Jun 15 13:28:48 UTC 2024


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

Summary:
6fb06a0bbc SCUMM: (MI1/Mac) - fix invalid mem access
a679820502 SCUMM: (MI1/Mac) - fix mem leak


Commit: 6fb06a0bbc17cafadad742605ac8afb3b5ae1434
    https://github.com/scummvm/scummvm/commit/6fb06a0bbc17cafadad742605ac8afb3b5ae1434
Author: athrxx (athrxx at scummvm.org)
Date: 2024-06-15T15:27:32+02:00

Commit Message:
SCUMM: (MI1/Mac) - fix invalid mem access

Changed paths:
    engines/scumm/players/player_mac_new.cpp


diff --git a/engines/scumm/players/player_mac_new.cpp b/engines/scumm/players/player_mac_new.cpp
index 4d73b346ba6..c7c2fce275c 100644
--- a/engines/scumm/players/player_mac_new.cpp
+++ b/engines/scumm/players/player_mac_new.cpp
@@ -735,6 +735,7 @@ void MacSndChannel::setupSound(const MacLowLevelPCMDriver::PCMSound *snd) {
 	_res = Common::SharedPtr<const int8>(buff, Common::ArrayDeleter<const int8>());
 	_frameSize = snd->stereo ? 2 : 1;
 	_loopSt = 0;
+	_data = nullptr;
 
 	if (snd->loopend - snd->loopst < 2 || snd->loopend < snd->loopst) {
 		_loopSt2 = 0;


Commit: a6798205023de2ea808d8846b488d5ccea1b9ea5
    https://github.com/scummvm/scummvm/commit/a6798205023de2ea808d8846b488d5ccea1b9ea5
Author: athrxx (athrxx at scummvm.org)
Date: 2024-06-15T15:27:32+02:00

Commit Message:
SCUMM: (MI1/Mac) - fix mem leak

Changed paths:
    engines/scumm/players/player_mac_new.cpp


diff --git a/engines/scumm/players/player_mac_new.cpp b/engines/scumm/players/player_mac_new.cpp
index c7c2fce275c..028844d52d0 100644
--- a/engines/scumm/players/player_mac_new.cpp
+++ b/engines/scumm/players/player_mac_new.cpp
@@ -40,6 +40,8 @@ namespace Scumm {
 class MacSndChannel {
 public:
 	MacSndChannel(MacLowLevelPCMDriver *drv, Audio::Mixer::SoundType sndtp, int synth, bool interp, bool enableL, bool enableR, MacLowLevelPCMDriver::ChanCallback *callback);
+	~MacSndChannel();
+
 	MacLowLevelPCMDriver::ChanHandle getHandle() const;
 
 	void playSamples(const MacLowLevelPCMDriver::PCMSound *snd);
@@ -515,6 +517,10 @@ MacSndChannel::MacSndChannel(MacLowLevelPCMDriver *drv, Audio::Mixer::SoundType
 	}
 }
 
+MacSndChannel::~MacSndChannel() {
+	flush();
+}
+
 MacLowLevelPCMDriver::ChanHandle MacSndChannel::getHandle() const {
 	const void *ptr = this;
 	return *reinterpret_cast<const int*>(&ptr);
@@ -557,6 +563,12 @@ void MacSndChannel::wait(uint32 duration) {
 }
 
 void MacSndChannel::flush() {
+	for (Common::Array<SoundCommand>::const_iterator i = _sndCmdQueue.begin(); i != _sndCmdQueue.end(); ++i) {
+		if (i->ptr && i->arg2 == 1)
+			delete reinterpret_cast<MacLowLevelPCMDriver::PCMSound*>(i->ptr);
+		else if (i->ptr && i->arg2 == 2)
+			delete[] reinterpret_cast<byte*>(i->ptr);
+	}
 	_sndCmdQueue.clear();
 	_tmrInc = 0;
 	_duration = 0;




More information about the Scummvm-git-logs mailing list