[Scummvm-git-logs] scummvm master -> 14748588ac930dc17d999a059e4fc7b0b7acb9f9

kelmer44 noreply at scummvm.org
Thu Jun 11 07:58:52 UTC 2026


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

Summary:
14748588ac PELROCK: Make sure pointers are initialized in sound.cpp PVS-Studio V575, V769


Commit: 14748588ac930dc17d999a059e4fc7b0b7acb9f9
    https://github.com/scummvm/scummvm/commit/14748588ac930dc17d999a059e4fc7b0b7acb9f9
Author: kelmer (kelmer at gmail.com)
Date: 2026-06-11T09:58:44+02:00

Commit Message:
PELROCK: Make sure pointers are initialized in sound.cpp PVS-Studio V575, V769

Changed paths:
    engines/pelrock/sound.cpp


diff --git a/engines/pelrock/sound.cpp b/engines/pelrock/sound.cpp
index 3a082f0918a..b6cdf46135a 100644
--- a/engines/pelrock/sound.cpp
+++ b/engines/pelrock/sound.cpp
@@ -184,7 +184,8 @@ int SoundManager::playSound(SonidoFile sound, int channel, int loopCount) {
 	sonidosFile.read(data, sound.size);
 	sonidosFile.close();
 
-	assert(data);
+	if (!data)
+		return -1;
 	SoundFormat format = detectFormat(data, sound.size);
 	uint32 sampleRate = getSampleRate(data, format);
 	Audio::SeekableAudioStream *stream = nullptr;
@@ -203,8 +204,11 @@ int SoundManager::playSound(SonidoFile sound, int channel, int loopCount) {
 
 		uint32 pcmSize = sound.size - headerSize;
 		byte *pcmData = (byte *)malloc(pcmSize);
-		assert(pcmData);
-		assert(data);
+		if (!pcmData || !data) {
+			free(data);
+			free(pcmData);
+			return -1;
+		}
 		memcpy(pcmData, data + headerSize, pcmSize);
 		free(data);
 




More information about the Scummvm-git-logs mailing list