[Scummvm-git-logs] scummvm master -> 30c05ee8c6f3654dbc04c0d4de8b4e6991ec9d59

sluicebox noreply at scummvm.org
Thu Mar 21 22:35:15 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:
30c05ee8c6 FREESCAPE: Fix memory leak


Commit: 30c05ee8c6f3654dbc04c0d4de8b4e6991ec9d59
    https://github.com/scummvm/scummvm/commit/30c05ee8c6f3654dbc04c0d4de8b4e6991ec9d59
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-03-21T15:33:13-07:00

Commit Message:
FREESCAPE: Fix memory leak

Coverity CID 1540629

Changed paths:
    engines/freescape/sound.cpp


diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index d3d1db4733d..6ecdb8b837c 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -39,9 +39,7 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 		int soundIdx = (i - 1) * 4;
 		file->seek(sfxTable + soundIdx);
 
-		byte *SFXtempStruct = (byte *)malloc(8 * sizeof(byte));
-		for (int j = 0; j < 8; j++)
-			SFXtempStruct[j] = 0;
+		byte SFXtempStruct[8] = {};
 
 		uint8 dataIndex = file->readByte();
 		uint16 soundValue = file->readUint16LE();
@@ -223,7 +221,6 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 				} while (soundSize != '\0');
 			}
 		}
-		free(SFXtempStruct);
 	}
 	//assert(0);
 }




More information about the Scummvm-git-logs mailing list