[Scummvm-git-logs] scummvm master -> b4f8be51740b128b0b57d85842984151ae92861e
sluicebox
noreply at scummvm.org
Wed Sep 18 19:45:40 UTC 2024
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a554cebbc4 SCI: Fix regression from Path migration
0f753cbeea SCI: Fix memory leak in GfxMacFontManager
99143ecb07 SCI: Fix memory leak in MidiPlayer_AmigaMac1
8a8de3502d SCI: Fix memory leak when reloading patch file resource
e893587ae2 SCI: Fix memory leak when patch files have same name
b4f8be5174 GRAPHICS: Fix memory leak in WinFont when reloading
Commit: a554cebbc467a73b52c6e6f835890ce3555ec05c
https://github.com/scummvm/scummvm/commit/a554cebbc467a73b52c6e6f835890ce3555ec05c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-09-18T12:40:59-07:00
Commit Message:
SCI: Fix regression from Path migration
Fixes MUMG Deluxe Mac crash on startup
See: 45286ad131cb538afea2694f159ee6b730114d7b
Changed paths:
engines/sci/resource/resource_audio.cpp
diff --git a/engines/sci/resource/resource_audio.cpp b/engines/sci/resource/resource_audio.cpp
index fd2b8cbf2d2..8965570fd0d 100644
--- a/engines/sci/resource/resource_audio.cpp
+++ b/engines/sci/resource/resource_audio.cpp
@@ -1280,9 +1280,8 @@ void ResourceManager::changeMacAudioDirectory(const Common::Path &path_) {
const Common::ArchiveMemberPtr &file = *it;
assert(file);
- const Common::Path fileName = file->getPathInArchive();
ResourceId resource36 = convertPatchNameBase36(kResourceTypeAudio36, file->getFileName());
- processWavePatch(resource36, path.join(fileName));
+ processWavePatch(resource36, file->getPathInArchive());
}
}
Commit: 0f753cbeea0d51fb1fff49382fc0e6dcb01edf8b
https://github.com/scummvm/scummvm/commit/0f753cbeea0d51fb1fff49382fc0e6dcb01edf8b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-09-18T12:40:59-07:00
Commit Message:
SCI: Fix memory leak in GfxMacFontManager
Changed paths:
engines/sci/graphics/macfont.cpp
diff --git a/engines/sci/graphics/macfont.cpp b/engines/sci/graphics/macfont.cpp
index 0685b5f28b3..0cf24b7e9fd 100644
--- a/engines/sci/graphics/macfont.cpp
+++ b/engines/sci/graphics/macfont.cpp
@@ -79,9 +79,12 @@ GfxMacFontManager::~GfxMacFontManager() {
// The font mapping table is a small binary resource with id 128 and type `ftbl`
bool GfxMacFontManager::initFromFontTable(Common::MacResManager *macExecutable) {
- Common::SeekableReadStream *table = macExecutable->getResource(MKTAG('f', 't', 'b', 'l'), 128);
- if (table == nullptr) {
- warning("Mac font table not found in \"%s\"", macExecutable->getBaseFileName().toString(Common::Path::kNativeSeparator).c_str());
+ Common::String macExecutableName = macExecutable->getBaseFileName().baseName();
+ Common::ScopedPtr<Common::SeekableReadStream> table(
+ macExecutable->getResource(MKTAG('f', 't', 'b', 'l'), 128)
+ );
+ if (!table) {
+ warning("Mac font table not found in \"%s\"", macExecutableName.c_str());
return false;
}
@@ -89,14 +92,14 @@ bool GfxMacFontManager::initFromFontTable(Common::MacResManager *macExecutable)
uint16 defaultFontIndex = table->readUint16BE();
uint16 numberOfFonts = table->readUint16BE();
if (table->eos() || table->size() < 4 + numberOfFonts * 10) {
- warning("Invalid mac font table in \"%s\"", macExecutable->getBaseFileName().toString(Common::Path::kNativeSeparator).c_str());
+ warning("Invalid mac font table in \"%s\"", macExecutableName.c_str());
return false;
}
for (uint16 i = 0; i < numberOfFonts; ++i) {
uint16 sciFontId = table->readUint16BE();
if (_macFonts.contains(sciFontId)) {
- warning("Duplicate Mac font table entry for %d in \"%s\"", sciFontId, macExecutable->getBaseFileName().toString(Common::Path::kNativeSeparator).c_str());
+ warning("Duplicate Mac font table entry for %d in \"%s\"", sciFontId, macExecutableName.c_str());
return false;
}
uint16 macFontId = table->readUint16BE();
@@ -107,7 +110,7 @@ bool GfxMacFontManager::initFromFontTable(Common::MacResManager *macExecutable)
const Graphics::Font *smallFont = getMacFont(macFontId, smallFontSize);
const Graphics::Font *largeFont = getMacFont(macFontId, MAX(mediumFontSize, largeFontSize));
if (smallFont == nullptr || largeFont == nullptr) {
- warning("Mac font %d not found in \"%s\"", macFontId, macExecutable->getBaseFileName().toString(Common::Path::kNativeSeparator).c_str());
+ warning("Mac font %d not found in \"%s\"", macFontId, macExecutableName.c_str());
return false;
}
Commit: 99143ecb071551a803c1b34845de458a2c86f54c
https://github.com/scummvm/scummvm/commit/99143ecb071551a803c1b34845de458a2c86f54c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-09-18T12:41:00-07:00
Commit Message:
SCI: Fix memory leak in MidiPlayer_AmigaMac1
Changed paths:
engines/sci/sound/drivers/amigamac1.cpp
diff --git a/engines/sci/sound/drivers/amigamac1.cpp b/engines/sci/sound/drivers/amigamac1.cpp
index e5e619d4940..a7257b6f897 100644
--- a/engines/sci/sound/drivers/amigamac1.cpp
+++ b/engines/sci/sound/drivers/amigamac1.cpp
@@ -71,6 +71,10 @@ protected:
Wave() : name(), phase1Start(0), phase1End(0), phase2Start(0), phase2End(0),
nativeNote(0), freqTable(nullptr), samples(nullptr), size(0) {}
+ ~Wave() {
+ delete[] samples;
+ }
+
char name[9];
uint16 phase1Start, phase1End;
uint16 phase2Start, phase2End;
Commit: 8a8de3502d8123c4db7b93d9a9d43a077422ac27
https://github.com/scummvm/scummvm/commit/8a8de3502d8123c4db7b93d9a9d43a077422ac27
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-09-18T12:41:00-07:00
Commit Message:
SCI: Fix memory leak when reloading patch file resource
Changed paths:
engines/sci/resource/resource.cpp
diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 991ee5a391f..0e4619409cb 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -222,6 +222,8 @@ Resource::~Resource() {
void Resource::unalloc() {
delete[] _data;
_data = nullptr;
+ delete[] _header;
+ _header = nullptr;
_status = kResStatusNoMalloc;
}
@@ -969,7 +971,7 @@ void ChunkResourceSource::loadResource(ResourceManager *resMan, Resource *res) {
byte *ptr = new byte[entry.length];
res->_data = ptr;
res->_size = entry.length;
- res->_header = 0;
+ res->_header = nullptr;
res->_headerSize = 0;
res->_status = kResStatusAllocated;
Commit: e893587ae27ebb75928a0bb5a473d997c7274066
https://github.com/scummvm/scummvm/commit/e893587ae27ebb75928a0bb5a473d997c7274066
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-09-18T12:41:00-07:00
Commit Message:
SCI: Fix memory leak when patch files have same name
Changed paths:
engines/sci/resource/resource.cpp
diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 0e4619409cb..6f4cc397c55 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -2242,6 +2242,12 @@ Resource *ResourceManager::updateResource(ResourceId resId, ResourceSource *src,
}
res->_status = kResStatusNoMalloc;
+ if (res->_source != nullptr && res->_source->getSourceType() == kSourcePatch) {
+ // This resource has already been loaded from another patch file.
+ // Sometimes a patch appears in a game's root and in "PATCHES".
+ // Delete the previous source before replacing it.
+ delete res->_source;
+ }
res->_source = src;
res->_headerSize = 0;
res->_fileOffset = offset;
Commit: b4f8be51740b128b0b57d85842984151ae92861e
https://github.com/scummvm/scummvm/commit/b4f8be51740b128b0b57d85842984151ae92861e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-09-18T12:41:01-07:00
Commit Message:
GRAPHICS: Fix memory leak in WinFont when reloading
Occurs during Hugo 1 introduction
Changed paths:
graphics/fonts/winfont.cpp
diff --git a/graphics/fonts/winfont.cpp b/graphics/fonts/winfont.cpp
index 1bcf9f51461..dc1687390c1 100644
--- a/graphics/fonts/winfont.cpp
+++ b/graphics/fonts/winfont.cpp
@@ -31,7 +31,7 @@
namespace Graphics {
WinFont::WinFont() {
- _glyphs = 0;
+ _glyphs = nullptr;
close();
}
@@ -47,7 +47,7 @@ void WinFont::close() {
_defaultChar = 0;
_glyphCount = 0;
delete[] _glyphs;
- _glyphs = 0;
+ _glyphs = nullptr;
}
// Reads a null-terminated string
@@ -246,6 +246,7 @@ bool WinFont::loadFromFNT(Common::SeekableReadStream &stream) {
// Begin loading in the glyphs
_glyphCount = (_lastChar - _firstChar) + 2;
+ delete[] _glyphs;
_glyphs = new GlyphEntry[_glyphCount];
for (uint16 i = 0; i < _glyphCount; i++) {
More information about the Scummvm-git-logs
mailing list