[Scummvm-git-logs] scummvm master -> 099163f422c3b659d18e50bf72f928aee43393c4
sluicebox
noreply at scummvm.org
Mon Apr 14 20:15:56 UTC 2025
This automated email contains information about 14 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
841d11261e DIRECTOR: XLIBS: Fix memory leaks in QTVR
dcbcb4295e DIRECTOR: XTRAS: Fix memory leaks in QTVR
88c6586c14 COMMON: Fix memory leak on zlib error
a97209336e DEVTOOLS: Close files
2fc6a2a158 AVALANCHE: Fix memory leak in ghostDrawBackgroundItems
cbea9d57cb COMMON: Fix memory leak in Cel3DODecoder
c294988090 NGI: Fix memory leaks
0663e3564f SCI32: Remove QFG4 Thieves' Guild script patch
732a2e21e3 DGDS: Fix memory leak in _doScroll
f42414df15 DGDS: Fix memory leaks in getMidiPatchData
cc455216bb ZVISION: Fix memory leak
cef6068d96 VIDEO: QTVR: Fix memory leak on error
3eb6a7b007 FREESCAPE: Fix memory leaks
099163f422 IMMORTAL: Fix memory leaks when decompressing
Commit: 841d11261ed989ac5564d1ec9a9ec65bb2c08941
https://github.com/scummvm/scummvm/commit/841d11261ed989ac5564d1ec9a9ec65bb2c08941
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
DIRECTOR: XLIBS: Fix memory leaks in QTVR
CID 1592308
CID 1592306
Changed paths:
engines/director/lingo/xlibs/qtvr.cpp
diff --git a/engines/director/lingo/xlibs/qtvr.cpp b/engines/director/lingo/xlibs/qtvr.cpp
index 3126f0d4d05..35e4fe1c9bd 100644
--- a/engines/director/lingo/xlibs/qtvr.cpp
+++ b/engines/director/lingo/xlibs/qtvr.cpp
@@ -211,6 +211,9 @@ void QTVR::m_mouseOver(int nargs) {
dither->getPixels(), dither->pitch, me->_rect.left, me->_rect.top, dither->w, dither->h
);
+ dither->free();
+ delete dither;
+
g_director->getCurrentWindow()->setDirty(true);
Common::Event event;
@@ -430,6 +433,9 @@ void QTVR::m_update(int nargs) {
g_director->getCurrentWindow()->getSurface()->copyRectToSurface(
dither->getPixels(), dither->pitch, me->_rect.left, me->_rect.top, dither->w, dither->h
);
+
+ dither->free();
+ delete dither;
}
Commit: dcbcb4295e4192d7ddd0207a12e25d35d9ce00cd
https://github.com/scummvm/scummvm/commit/dcbcb4295e4192d7ddd0207a12e25d35d9ce00cd
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
DIRECTOR: XTRAS: Fix memory leaks in QTVR
CID 1591779
CID 1591777
CID 1590830
Changed paths:
engines/director/lingo/xtras/qtvrxtra.cpp
diff --git a/engines/director/lingo/xtras/qtvrxtra.cpp b/engines/director/lingo/xtras/qtvrxtra.cpp
index 8fcbd43ef15..9eda78d2329 100644
--- a/engines/director/lingo/xtras/qtvrxtra.cpp
+++ b/engines/director/lingo/xtras/qtvrxtra.cpp
@@ -449,6 +449,9 @@ void QtvrxtraXtra::m_QTVRIdle(int nargs) {
g_director->getCurrentWindow()->getSurface()->copyRectToSurface(
dither->getPixels(), dither->pitch, me->_rect.left, me->_rect.top, dither->w, dither->h
);
+
+ dither->free();
+ delete dither;
}
void QtvrxtraXtra::m_QTVRMouseDown(int nargs) {
@@ -484,6 +487,9 @@ void QtvrxtraXtra::m_QTVRMouseDown(int nargs) {
dither->getPixels(), dither->pitch, me->_rect.left, me->_rect.top, dither->w, dither->h
);
+ dither->free();
+ delete dither;
+
g_director->getCurrentWindow()->setDirty(true);
node = me->_video->getCurrentNodeID();
@@ -572,6 +578,9 @@ void QtvrxtraXtra::m_QTVRMouseOver(int nargs) {
dither->getPixels(), dither->pitch, me->_rect.left, me->_rect.top, dither->w, dither->h
);
+ dither->free();
+ delete dither;
+
g_director->getCurrentWindow()->setDirty(true);
Common::Event event;
Commit: 88c6586c1486ab45ebb1db89952cf2a0d783d5b6
https://github.com/scummvm/scummvm/commit/88c6586c1486ab45ebb1db89952cf2a0d783d5b6
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
COMMON: Fix memory leak on zlib error
CID 1591742
Changed paths:
common/compression/zlib.cpp
devtools/create_titanic/zlib.cpp
diff --git a/common/compression/zlib.cpp b/common/compression/zlib.cpp
index f52e3f3984d..c0e0efd053a 100644
--- a/common/compression/zlib.cpp
+++ b/common/compression/zlib.cpp
@@ -68,8 +68,10 @@ bool inflateZlibHeaderless(byte *dst, uint *dstLen, const byte *src, uint srcLen
// Set the dictionary, if provided
if (dict != nullptr) {
err = inflateSetDictionary(&stream, const_cast<byte *>(dict), dictLen);
- if (err != Z_OK)
+ if (err != Z_OK) {
+ inflateEnd(&stream);
return false;
+ }
}
err = inflate(&stream, Z_SYNC_FLUSH);
diff --git a/devtools/create_titanic/zlib.cpp b/devtools/create_titanic/zlib.cpp
index 0d2645b443d..0712aa7d6fd 100644
--- a/devtools/create_titanic/zlib.cpp
+++ b/devtools/create_titanic/zlib.cpp
@@ -80,8 +80,10 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen,
// Set the dictionary, if provided
if (dict != nullptr) {
err = inflateSetDictionary(&stream, const_cast<byte *>(dict), dictLen);
- if (err != Z_OK)
+ if (err != Z_OK) {
+ inflateEnd(&stream);
return false;
+ }
}
err = inflate(&stream, Z_SYNC_FLUSH);
Commit: a97209336e1633315678a314e0c3576e362b3d7f
https://github.com/scummvm/scummvm/commit/a97209336e1633315678a314e0c3576e362b3d7f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
DEVTOOLS: Close files
CID 1591724
CID 1591692
CID 1591624
Changed paths:
devtools/create_access/create_access_dat.cpp
devtools/create_supernova/create_supernova.cpp
diff --git a/devtools/create_access/create_access_dat.cpp b/devtools/create_access/create_access_dat.cpp
index 7c66c38cc57..daafce3f506 100644
--- a/devtools/create_access/create_access_dat.cpp
+++ b/devtools/create_access/create_access_dat.cpp
@@ -201,8 +201,10 @@ void writeMartianCommonData(int argc, char *argv[]) {
outputFile->write(exeFile, FONT_DATA_SIZE[fontNum]);
}
+ exeFile.close();
return;
}
+ exeFile.close();
}
// No executable found, so store 0 size fonts
@@ -334,6 +336,7 @@ bool processExecutable(int exeIdx, const char *name) {
// Martian Memorandum English packed
printf("Martian Memorandum provided that's packed with EXEPACK.\n");
printf("It needs to be first unpacked before it can be used with this tool.\n");
+ exeFile.close();
return false;
case 10454:
diff --git a/devtools/create_supernova/create_supernova.cpp b/devtools/create_supernova/create_supernova.cpp
index 374e1f94201..fbc2548dc4f 100644
--- a/devtools/create_supernova/create_supernova.cpp
+++ b/devtools/create_supernova/create_supernova.cpp
@@ -189,6 +189,7 @@ void writeImage(File& outputFile, const char *name, const char* language) {
} else
str[i++] = c;
if (imgFile.eof()) {
+ imgFile.close();
printf("Unexpected end of file in '%s' while reading pbm header! This image will be skipped.\n", fileName);
return;
}
Commit: 2fc6a2a1586f146bd1322a3f8e15470fd05b8c12
https://github.com/scummvm/scummvm/commit/2fc6a2a1586f146bd1322a3f8e15470fd05b8c12
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
AVALANCHE: Fix memory leak in ghostDrawBackgroundItems
CID 1591697
Changed paths:
engines/avalanche/graphics.cpp
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 59e08204f2d..f28988ae298 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -621,11 +621,11 @@ void GraphicManager::ghostDrawBackgroundItems(Common::File &file) {
int height = cb._height + 1;
Graphics::Surface picture;
- picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
// Load the picture according to it's type.
switch (cb._flavour) {
case kFlavourOne: // There is only one plane.
+ picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
for (uint16 y = 0; y < height; y++) {
for (uint16 x = 0; x < width; x += 8) {
byte pixel = file.readByte();
@@ -640,6 +640,7 @@ void GraphicManager::ghostDrawBackgroundItems(Common::File &file) {
picture = loadPictureRaw(file, width, height);
break;
default:
+ picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
break;
}
Commit: cbea9d57cb6b71f9c71056949b4beb163b96ecfa
https://github.com/scummvm/scummvm/commit/cbea9d57cb6b71f9c71056949b4beb163b96ecfa
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
COMMON: Fix memory leak in Cel3DODecoder
CID 1591690
Changed paths:
image/cel_3do.cpp
diff --git a/image/cel_3do.cpp b/image/cel_3do.cpp
index de564f08860..eace5cc14ad 100644
--- a/image/cel_3do.cpp
+++ b/image/cel_3do.cpp
@@ -102,6 +102,7 @@ bool Cel3DODecoder::loadStream(Common::SeekableReadStream &stream) {
// Only RGB555 is supported
if ((pre0 & 0x17) != 0x16) {
+ surface->free();
delete surface;
return false;
}
Commit: c294988090676ef23bd9b442526e44baf81d3ffb
https://github.com/scummvm/scummvm/commit/c294988090676ef23bd9b442526e44baf81d3ffb
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
NGI: Fix memory leaks
CID 1591678
CID 1591664
Changed paths:
engines/ngi/motion.cpp
diff --git a/engines/ngi/motion.cpp b/engines/ngi/motion.cpp
index 83317e65d95..4e237eebd49 100644
--- a/engines/ngi/motion.cpp
+++ b/engines/ngi/motion.cpp
@@ -370,6 +370,8 @@ void MctlLadder::attachObject(StaticANIObject *obj) {
_aniHandler.attachObject(obj->_id);
_ladmovements.push_back(movement);
} else {
+ delete movement->movVars;
+ delete[] movement->staticIds;
delete movement;
}
}
@@ -385,6 +387,8 @@ int MctlLadder::findObjectPos(StaticANIObject *obj) {
bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement) {
debugC(4, kDebugPathfinding, "MctlLadder::initMovement(*%d, ...)", ani->_id);
+ movement->movVars = nullptr;
+ movement->staticIds = nullptr;
GameVar *v = g_nmi->getGameLoaderGameVar()->getSubVarByName(ani->getName());
Commit: 0663e3564f022ffa194cbc5a9e0dafe3dfe8da3c
https://github.com/scummvm/scummvm/commit/0663e3564f022ffa194cbc5a9e0dafe3dfe8da3c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
SCI32: Remove QFG4 Thieves' Guild script patch
Fixes bug #15776
Changed paths:
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 4871cebeec3..68bc8e6ba2c 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -111,7 +111,7 @@ static const char *const selectorNameTable[] = {
"localize", // Freddy Pharkas
"roomFlags", // Iceman
"put", // Police Quest 1 VGA
- "approachVerbs", // Police Quest 1 VGA, QFG4
+ "approachVerbs", // Police Quest 1 VGA
"newRoom", // Police Quest 3, GK1
"register", // Quest For Glory 1 EGA, QFG4
"changeState", // Quest For Glory 1 VGA, QFG4
@@ -161,7 +161,7 @@ static const char *const selectorNameTable[] = {
"delete", // EcoQuest 1
"size", // EcoQuest 1
"signal", // EcoQuest 1, GK1
- "obstacles", // EcoQuest 1, QFG4
+ "obstacles", // EcoQuest 1
"handleEvent", // EcoQuest 2, Shivers
"view", // King's Quest 4, RAMA benchmarking, GK1, QFG4
"tWindow", // Camelot
@@ -199,7 +199,6 @@ static const char *const selectorNameTable[] = {
"readWord", // LSL7, Phant1, Torin
"points", // PQ4
"select", // PQ4
- "addObstacle", // QFG4
"saveFilePtr", // RAMA
"priority", // RAMA
"plane", // RAMA
@@ -344,7 +343,6 @@ enum ScriptPatcherSelectors {
SELECTOR_readWord,
SELECTOR_points,
SELECTOR_select,
- SELECTOR_addObstacle,
SELECTOR_saveFilePtr,
SELECTOR_priority,
SELECTOR_plane,
@@ -18940,254 +18938,6 @@ static const uint16 qfg4StuckDoorPatch[] = {
PATCH_END
};
-// In the thieves' guild (room 430), the tunnel is not immediately walkable
-// when it is revealed (by moving a barrel and solving a puzzle). Hero must
-// re-enter the room to update the polygon.
-//
-// Curing Chief *will* immediately replace the polygon. However, most players
-// will lack the item necessary on the first visit. Meeting Chief is how they
-// learn about the item. If they go get it, they'll re-enter the room.
-//
-// The room's init has a cond block to check plot flags and declare one of 3
-// polygons. The 3rd condition also inits secritExit, an invisible Feature
-// that sends hero out of town when walked upon.
-//
-// Patch 1: Other patches ensure the passage will be walkable the moment it is
-// revealed. Chief is standing inside it. We skip the original code that would
-// set up the passage as he gets cured. It is redundant now. If hero can reach
-// him, the passage is already revealed. We won't let secritExit init twice.
-//
-// Patch 2: We free bytes in rm340::init() by condensing Feature inits with a
-// loop. Stack up their addresses. Pop & send repeatedly. Then we declare a
-// subroutine that disposes any existing obstacles, jumps into the cond block
-// to declare the 3rd poly, jumps back, passes it to addObstacles(), and inits
-// secritExit.
-//
-// When the cond block's 3rd condition runs, we immediately call our
-// subroutine to do everything and end the cond, leaving the original polygon
-// declaration intact below the jump.
-//
-// Patch 3: The passage starts opening at sBarrelMove state 8. We need more
-// room than case 8 can offer, so we arrange for *multiple* cases to run
-// during state 8 - by omitting the final jump that would short-circuit.
-//
-// Cases 1-5 have derelict code, once intended to move the barrel back and
-// forth, now only left. This is because barrel::doVerb(4) schedules
-// sBarrelMove in the absence of flag 254 and sets register=1 if the barrel is
-// in the left position already. Case 0 uses the same criteria in deciding to
-// skip to state 6. Thus cases 1-5 never see register==1. The barrel never
-// moves back, and bytes predicated on register==1 are available.
-//
-// We reduce case 2 to only the necessary ops and splice in a new case that
-// runs during state 8 as a prologue to the original case 8. Our prologue
-// calls the subroutine to add the 3rd polygon. This patch has two variants,
-// toggled to match the detected edition with enablePatch() below. Aside from
-// the call offset, they are identical.
-//
-// Applies to at least: English CD, English floppy, German floppy
-// Responsible method: sChangeThief::changeState() in script 340
-// Fixes bug: #9894
-static const uint16 qfg4GuildWalkSignature1[] = {
- 0x38, SIG_SELECTOR16(dispose), // pushi dispose
- SIG_ADDTOOFFSET(+20), // ... (dispose and null global[2]'s "obstacles" property)
- 0x4a, SIG_UINT16(0x0006), // send 6d
- SIG_ADDTOOFFSET(+85), // ...
- SIG_ADDTOOFFSET(+238), // ... (secritExit init and addObstacle)
- SIG_MAGICDWORD,
- 0x4a, SIG_UINT16(0x00a6), // send 166d (polygon init)
- 0x36, // push
- SIG_ADDTOOFFSET(+5), // ... (global[2] addObstacle: polygon)
- SIG_END
-};
-
-static const uint16 qfg4GuildWalkPatch1[] = {
- 0x32, PATCH_UINT16(0x0017), // jmp 23d (skip obstacles disposal)
- PATCH_ADDTOOFFSET(+108),
- 0x32, PATCH_UINT16(0x00f4), // jmp 244d (skip secritExit and polygon)
- PATCH_END
-};
-
-// Responsible method: rm340::init() in script 340
-static const uint16 qfg4GuildWalkSignature2[] = {
- 0x38, SIG_SELECTOR16(init), // pushi init
- 0x76, // push0
- 0x38, SIG_SELECTOR16(approachVerbs), // pushi approachVerbs
- 0x78, // push1
- 0x39, 0x04, // pushi 4d
- 0x72, SIG_ADDTOOFFSET(+2), // lofsa steps1
- 0x4a, SIG_UINT16(0x000a), // send 10d
-
- SIG_ADDTOOFFSET(+10), // ... (similar inits follow)
- 0x72, SIG_ADDTOOFFSET(+2), // lofsa steps2
- SIG_ADDTOOFFSET(+13), // ...
- 0x72, SIG_ADDTOOFFSET(+2), // lofsa barrels1
- SIG_ADDTOOFFSET(+13), // ...
- 0x72, SIG_ADDTOOFFSET(+2), // lofsa barrels2
- SIG_ADDTOOFFSET(+13), // ...
- 0x72, SIG_ADDTOOFFSET(+2), // lofsa crack1
- SIG_ADDTOOFFSET(+13), // ...
- 0x72, SIG_ADDTOOFFSET(+2), // lofsa crack2
- SIG_ADDTOOFFSET(+13), // ...
- 0x72, SIG_ADDTOOFFSET(+2), // lofsa pillar
- SIG_ADDTOOFFSET(+3), // ...
-
- SIG_ADDTOOFFSET(+26), // ... (global[78]::add() steps1 and steps2)
-
- SIG_ADDTOOFFSET(+459), // ... (cond block for polygons)
- SIG_MAGICDWORD,
- 0x32, SIG_UINT16(0x00f7), // jmp 247d [end the cond] (2nd condition done)
-
- // (else condition)
- 0x38, SIG_SELECTOR16(init), // pushi init
- 0x76, // push0
- 0x72, SIG_ADDTOOFFSET(+2), // lofsa secritExit
- 0x4a, SIG_UINT16(0x0004), // send 4d
- SIG_ADDTOOFFSET(+4), // ... (addObstacle and its arg count)
- SIG_ADDTOOFFSET(+228), // ... (3rd Polygon type, init, and push)
- SIG_ADDTOOFFSET(+5), // ... (end of the polygons cond)
-
- 0x38, SIG_SELECTOR16(init), // pushi init (super init:)
- SIG_END
-};
-
-static const uint16 qfg4GuildWalkPatch2[] = {
- 0x3f, 0x02, // link 02 (set up loop vars, op affects the stack)
- 0x74, PATCH_GETORIGINALUINT16(11), // lofss steps1
- 0x74, PATCH_GETORIGINALUINT16(27), // lofss steps2
- 0x74, PATCH_GETORIGINALUINT16(43), // lofss barrels1
- 0x74, PATCH_GETORIGINALUINT16(59), // lofss barrels2
- 0x74, PATCH_GETORIGINALUINT16(75), // lofss crack1
- 0x74, PATCH_GETORIGINALUINT16(91), // lofss crack2
- 0x74, PATCH_GETORIGINALUINT16(107), // lofss pillar
- //
- 0x35, 0x08, // ldi 8d (decrement and send 7 times, while != 0)
- 0xa5, 0x00, // sat temp[0]
- //
- 0xe5, 0x00, // -at temp[0]
- 0x31, 0x13, // bnt 19d [on 0, end the loop]
- 0xad, 0x01, // sst temp[1] (pop the next object into a temp var)
- 0x38, PATCH_SELECTOR16(init), // pushi init
- 0x76, // push0
- 0x38, PATCH_SELECTOR16(approachVerbs), // pushi approachVerbs
- 0x78, // push1
- 0x39, 0x04, // pushi 4d
- 0x85, 0x01, // lat temp[1] (accumulate the object)
- 0x4a, PATCH_UINT16(0x000a), // send 10d
- 0x33, 0xe9, // jmp -23d [loop]
-
- 0x33, 0x33, // jmp 51d [skip subroutine declaration]
- 0x38, PATCH_SELECTOR16(obstacles), // pushi obstacles (look up "obstacles", might be null)
- 0x76, // push0
- 0x81, 0x02, // lag global[2]
- 0x4a, PATCH_UINT16(0x0004), // send 4d
- 0x31, 0x11, // bnt 17d [skip disposal and nulling]
- 0x38, PATCH_SELECTOR16(dispose), // pushi dispose
- 0x76, // push0
- 0x4a, PATCH_UINT16(0x0004), // send 4d ((global[2] obstacles?) dispose:)
- //
- 0x38, PATCH_SELECTOR16(obstacles), // pushi obstacles (null the "obstacles" property)
- 0x78, // push1
- 0x76, // push0
- 0x81, 0x02, // lag global[2]
- 0x4a, PATCH_UINT16(0x0006), // send 6d
- //
- 0x38, PATCH_SELECTOR16(addObstacle), // pushi addObstacle
- 0x78, // push1
- 0x32, PATCH_UINT16(0x020f), // jmp 527d [3rd polygon type, init, and push]
- // (That will jmp back here)
- 0x81, 0x02, // lag global[2]
- 0x4a, PATCH_UINT16(0x0006), // send 6d
- //
- 0x38, PATCH_SELECTOR16(init), // pushi init
- 0x76, // push0
- 0x72, PATCH_GETORIGINALUINT16(605), // lofsa secritExit
- 0x4a, PATCH_UINT16(0x0004), // send 4d
- 0x48, // ret
-
- 0x33, 0x07, // jmp 7d [skip waste bytes, to (global[78] add: steps1)]
- 0x5c, // selfID (waste 1 byte)
- PATCH_ADDTOOFFSET(+494), // ...
- 0x76, // push0 (0 call args, clobber the old secritExit init)
- 0x40, PATCH_UINT16(0xfdd6), PATCH_UINT16(0x0000), // call 0d [-554] (the subroutine does everything)
- 0x32, PATCH_UINT16(0x00ee), // jmp 238d [end the cond]
- 0x5c, // selfID (waste 1 byte)
- PATCH_ADDTOOFFSET(+4), // ...
- PATCH_ADDTOOFFSET(+228), // ... (3rd polygon type, init, and push)
- 0x32, PATCH_UINT16(0xfd0a), // jmp -758d [back into the subroutine]
- 0x35, 0x00, // ldi 0 (erase 2 bytes to keep disasm aligned)
- PATCH_END
-};
-
-// Applies to at least: English CD
-// Responsible method: sBarrelMove::changeState(2) in script 340
-static const uint16 qfg4GuildWalkCDSignature3[] = {
- SIG_MAGICDWORD,
- 0x30, SIG_UINT16(0x0032), // bnt 50d [next case]
- 0x35, 0x02, // ldi 2d (case 2 label)
- SIG_ADDTOOFFSET(+26), // ... (register branch and derelict say())
- SIG_ADDTOOFFSET(+19), // ... (else, the rest of case 2 is a necessary say())
- 0x32, SIG_ADDTOOFFSET(+2), // jmp ?? [end the switch]
- SIG_END
-};
-
-static const uint16 qfg4GuildWalkCDPatch3[] = {
- 0x31, 0x15, // bnt 21d [next case]
- 0x38, PATCH_SELECTOR16(say), // pushi say
- 0x39, 0x05, // pushi 5d
- 0x39, 0x06, // pushi 6d
- 0x39, 0x04, // pushi 4d
- 0x39, 0x13, // pushi 19d
- 0x76, // push0
- 0x7c, // pushSelf
- 0x81, 0x5b, // lag global[91]
- 0x4a, PATCH_UINT16(0x000e), // send 14d
- 0x32, PATCH_GETORIGINALUINT16ADJUST(51, +30), // jmp ?? [end the switch]
-
- 0x3c, // dup (case 8 prologue)
- 0x35, 0x08, // ldi 8d
- 0x1a, // eq?
- 0x31, 0x06, // bnt 6d [next case]
- 0x76, // push0 (0 call args)
- 0x40, PATCH_UINT16(0xf592), PATCH_UINT16(0x0000), // call [-2670], 0d (patch 2's subroutine)
- 0x33, 0x10, // jmp 16d [skip waste bytes]
- PATCH_END // (don't end the switch, keep testing cases)
-};
-
-// Applies to at least: English floppy, German floppy
-// Responsible method: sBarrelMove::changeState(2) in script 340
-static const uint16 qfg4GuildWalkFloppySignature3[] = {
- SIG_MAGICDWORD,
- 0x30, SIG_UINT16(0x0032), // bnt 50d [next case]
- 0x35, 0x02, // ldi 2d (case 2 label)
- SIG_ADDTOOFFSET(+26), // ... (register branch and derelict say())
- SIG_ADDTOOFFSET(+19), // ... (else, the rest of case 2 is a necessary say())
- 0x32, SIG_ADDTOOFFSET(+2), // jmp ?? [end the switch]
- SIG_END
-};
-
-static const uint16 qfg4GuildWalkFloppyPatch3[] = {
- 0x31, 0x15, // bnt 21d [next case]
- 0x38, PATCH_SELECTOR16(say), // pushi say
- 0x39, 0x05, // pushi 5d
- 0x39, 0x06, // pushi 6d
- 0x39, 0x04, // pushi 4d
- 0x39, 0x13, // pushi 19d
- 0x76, // push0
- 0x7c, // pushSelf
- 0x81, 0x5b, // lag global[91]
- 0x4a, PATCH_UINT16(0x000e), // send 14d
- 0x32, PATCH_GETORIGINALUINT16ADJUST(51, +30), // jmp ?? [end the switch]
-
- 0x3c, // dup (case 8 prologue)
- 0x35, 0x08, // ldi 8d
- 0x1a, // eq?
- 0x31, 0x06, // bnt 6d [next case]
- 0x76, // push0 (0 call args)
- 0x40, PATCH_UINT16(0xf5a8), PATCH_UINT16(0x0000), // call [-2648], 0d (patch 2's subroutine)
- 0x33, 0x10, // jmp 16d [skip waste bytes]
- PATCH_END // (don't end the switch, keep testing cases)
-};
-
// Rations are not properly decremented by daily scheduled meal consumption.
// Rations are consumed periodically as time advances. If rations are the
// active inventory item when the last of them is eaten, that icon will persist
@@ -21601,10 +21351,6 @@ static const SciScriptPatcherEntry qfg4Signatures[] = {
{ true, 320, "fix talking to absent innkeeper", 1, qfg4AbsentInnkeeperSignature, qfg4AbsentInnkeeperPatch },
{ true, 320, "CD: fix domovoi never appearing", 1, qfg4DomovoiInnSignature, qfg4DomovoiInnPatch },
{ true, 324, "CD: fix domovoi never appearing", 1, qfg4DomovoiInnSignature, qfg4DomovoiInnPatch },
- { true, 340, "CD/Floppy: fix guild tunnel access (1/3)", 1, qfg4GuildWalkSignature1, qfg4GuildWalkPatch1 },
- { true, 340, "CD/Floppy: fix guild tunnel access (2/3)", 1, qfg4GuildWalkSignature2, qfg4GuildWalkPatch2 },
- { false, 340, "CD: fix guild tunnel access (3/3)", 1, qfg4GuildWalkCDSignature3, qfg4GuildWalkCDPatch3 },
- { false, 340, "Floppy: fix guild tunnel access (3/3)", 1, qfg4GuildWalkFloppySignature3, qfg4GuildWalkFloppyPatch3 },
{ true, 440, "fix setLooper calls (1/2)", 1, qfg4SetLooperSignature1, qfg4SetLooperPatch1 },
{ true, 475, "fix tarot 3 queen card", 1, qfg4Tarot3QueenSignature, qfg4Tarot3QueenPatch },
{ true, 475, "fix tarot 3 death card", 1, qfg4Tarot3DeathSignature, qfg4Tarot3DeathPatch },
@@ -26735,11 +26481,9 @@ void ScriptPatcher::processScript(uint16 scriptNr, SciSpan<byte> scriptData) {
enablePatch(signatureTable, "CD: fix rope during Igor rescue (2/2)");
// Similar signatures that patch with different addresses/offsets
- enablePatch(signatureTable, "CD: fix guild tunnel access (3/3)");
enablePatch(signatureTable, "CD: fix crest bookshelf");
enablePatch(signatureTable, "CD: fix peer bats, upper door (2/2)");
} else {
- enablePatch(signatureTable, "Floppy: fix guild tunnel access (3/3)");
enablePatch(signatureTable, "Floppy: fix crest bookshelf");
enablePatch(signatureTable, "Floppy: fix peer bats, upper door (2/2)");
}
Commit: 732a2e21e3fe72d1a501392a91d0f50a3b59d749
https://github.com/scummvm/scummvm/commit/732a2e21e3fe72d1a501392a91d0f50a3b59d749
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
DGDS: Fix memory leak in _doScroll
CID 1591647
Changed paths:
engines/dgds/ttm.cpp
diff --git a/engines/dgds/ttm.cpp b/engines/dgds/ttm.cpp
index 354c14152aa..c36e3941613 100644
--- a/engines/dgds/ttm.cpp
+++ b/engines/dgds/ttm.cpp
@@ -371,6 +371,7 @@ static void _doScroll(Graphics::ManagedSurface &compBuf, int16 dir, int16 steps,
screen = g_system->lockScreen();
}
g_system->unlockScreen();
+ screenCopy.free();
}
void TTMInterpreter::doWipeOp(uint16 code, const TTMEnviro &env, const TTMSeq &seq, const Common::Rect &r) {
Commit: f42414df1580c6e72f273b94c91794b4b391bbf7
https://github.com/scummvm/scummvm/commit/f42414df1580c6e72f273b94c91794b4b391bbf7
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
DGDS: Fix memory leaks in getMidiPatchData
CID 1592973
Changed paths:
engines/dgds/sound/drivers/midipatch.cpp
diff --git a/engines/dgds/sound/drivers/midipatch.cpp b/engines/dgds/sound/drivers/midipatch.cpp
index 645fd530351..2725c297bdc 100644
--- a/engines/dgds/sound/drivers/midipatch.cpp
+++ b/engines/dgds/sound/drivers/midipatch.cpp
@@ -23,6 +23,7 @@
#include "common/config-manager.h"
#include "common/file.h"
#include "common/memstream.h"
+#include "common/ptr.h"
#include "dgds/sound/resource/sci_resource.h"
#include "dgds/dgds.h"
@@ -48,12 +49,12 @@ SciResource *getMidiPatchData(int num) {
DgdsEngine *engine = DgdsEngine::getInstance();
ResourceManager *resource = engine->getResourceManager();
Decompressor *decomp = engine->getDecompressor();
- ResourceManager *fddMgr = nullptr;
- Common::SeekableReadStream *ovlStream = nullptr;
+ Common::ScopedPtr<ResourceManager> fddMgr;
+ Common::ScopedPtr<Common::SeekableReadStream> ovlStream;
int resNum = 0;
for (; resNum < ARRAYSIZE(PATCH_RESOURCES); resNum++) {
- ovlStream = resource->getResource(PATCH_RESOURCES[resNum]);
+ ovlStream.reset(resource->getResource(PATCH_RESOURCES[resNum]));
if (ovlStream)
break;
}
@@ -64,12 +65,11 @@ SciResource *getMidiPatchData(int num) {
// This is how the data comes arranged in the GOG version.
//
if (num == 1 && engine->getGameId() == GID_WILLY) {
- fddMgr = new ResourceManager("FDD");
- if (fddMgr->hasResource("SX.OVL")) {
+ fddMgr.reset(new ResourceManager("FDD"));
+ if (fddMgr.get()->hasResource("SX.OVL")) {
debug("Overriding MT32 patch data with patches from FDD version.");
- delete ovlStream;
resNum = 2;
- ovlStream = fddMgr->getResource("SX.OVL");
+ ovlStream.reset(fddMgr.get()->getResource("SX.OVL"));
}
}
@@ -78,7 +78,7 @@ SciResource *getMidiPatchData(int num) {
return nullptr;
}
- DgdsChunkReader chunk(ovlStream);
+ DgdsChunkReader chunk(ovlStream.get());
const Common::String targetSection = Common::String::format("%03d:", num);
@@ -108,10 +108,6 @@ SciResource *getMidiPatchData(int num) {
}
}
- delete ovlStream;
- if (fddMgr)
- delete fddMgr;
-
warning("Didn't find section %s in midi patch resource %s", targetSection.c_str(), PATCH_RESOURCES[resNum]);
return nullptr;
Commit: cc455216bbf1b6119783986ebc2679abbac0e6b5
https://github.com/scummvm/scummvm/commit/cc455216bbf1b6119783986ebc2679abbac0e6b5
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
ZVISION: Fix memory leak
CID 1591627
Changed paths:
engines/zvision/scripting/actions.cpp
diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index 2cbd5fe934a..da35678cfa8 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -797,6 +797,7 @@ bool ActionRegion::execute() {
EffectMap *_map = _engine->getRenderManager()->makeEffectMap(tempMask, 0);
effect = new FogFx(_engine, _slotKey, _rect, _unk1, _map, buf);
+ tempMask.free();
}
break;
default:
Commit: cef6068d96a8fd064cfc6bf9069841f9e84eac97
https://github.com/scummvm/scummvm/commit/cef6068d96a8fd064cfc6bf9069841f9e84eac97
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
VIDEO: QTVR: Fix memory leak on error
CID 1591257
Changed paths:
video/qtvr_decoder.cpp
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 5266adc45ed..e1872c3b6f6 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -575,6 +575,8 @@ Graphics::Surface *QuickTimeDecoder::PanoTrackHandler::constructMosaic(VideoTrac
Common::DumpFile bitmapFile;
if (!bitmapFile.open(path, true)) {
warning("Cannot dump panorama into file '%s'", path.toString().c_str());
+ target->free();
+ delete target;
return nullptr;
}
Commit: 3eb6a7b00700721a1f11a901610cc5af80e9d6e6
https://github.com/scummvm/scummvm/commit/3eb6a7b00700721a1f11a901610cc5af80e9d6e6
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
FREESCAPE: Fix memory leaks
CID 1591252
CID 1591030
CID 1609066
Changed paths:
engines/freescape/games/dark/c64.cpp
engines/freescape/games/driller/atari.cpp
engines/freescape/games/driller/c64.cpp
diff --git a/engines/freescape/games/dark/c64.cpp b/engines/freescape/games/dark/c64.cpp
index 30535e230e9..3af20185a4d 100644
--- a/engines/freescape/games/dark/c64.cpp
+++ b/engines/freescape/games/dark/c64.cpp
@@ -44,6 +44,8 @@ void DarkEngine::loadAssetsC64FullGame() {
surf->convertToInPlace(_gfx->_texturePixelFormat);
_border = new Graphics::ManagedSurface();
_border->copyFrom(*surf);
+ surf->free();
+ delete surf;
}
diff --git a/engines/freescape/games/driller/atari.cpp b/engines/freescape/games/driller/atari.cpp
index 611b5e94370..ed80ca75654 100644
--- a/engines/freescape/games/driller/atari.cpp
+++ b/engines/freescape/games/driller/atari.cpp
@@ -84,7 +84,7 @@ void DrillerEngine::loadAssetsAtariFullGame() {
if (isSpaceStationOblivion()) {
_border = loadAndConvertNeoImage(&file, 0x13544);
- byte *palette = (byte *)malloc(16 * 3);
+ byte palette[16 * 3];
for (int i = 0; i < 16; i++) { // gray scale palette
palette[i * 3 + 0] = i * (255 / 16);
palette[i * 3 + 1] = i * (255 / 16);
diff --git a/engines/freescape/games/driller/c64.cpp b/engines/freescape/games/driller/c64.cpp
index 253a82c40ee..aef3b6eed91 100644
--- a/engines/freescape/games/driller/c64.cpp
+++ b/engines/freescape/games/driller/c64.cpp
@@ -145,6 +145,8 @@ void DrillerEngine::loadAssetsC64FullGame() {
surf->convertToInPlace(_gfx->_texturePixelFormat);
_border = new Graphics::ManagedSurface();
_border->copyFrom(*surf);
+ surf->free();
+ delete surf;
/*file.close();
file.open("driller.c64.title.bitmap");
Commit: 099163f422c3b659d18e50bf72f928aee43393c4
https://github.com/scummvm/scummvm/commit/099163f422c3b659d18e50bf72f928aee43393c4
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-14T13:15:09-07:00
Commit Message:
IMMORTAL: Fix memory leaks when decompressing
CID 1509048
CID 1509032
Changed paths:
engines/immortal/compression.cpp
diff --git a/engines/immortal/compression.cpp b/engines/immortal/compression.cpp
index 344b8c7ecf5..1e874b688cf 100644
--- a/engines/immortal/compression.cpp
+++ b/engines/immortal/compression.cpp
@@ -49,6 +49,11 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *source, int
* Stack contains the currently being recreated string before it gets sent to the output
*/
+ // If the source data has no length, we certainly do not want to decompress it
+ if (lSource == 0) {
+ return nullptr;
+ }
+
// In the source, the data allocated here is a pointer passed to the function, but it's only used by this anyway
uint16 *pCodes = (uint16 *)malloc(k8K); // The Codes stack has 8 * 1024 bytes allocated
uint16 *pTk = (uint16 *)malloc(k8K); // The Tk has 8 * 1024 bytes allocated
@@ -63,11 +68,6 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *source, int
uint16 findEmpty = 0;
uint16 index = 0;
- // If the source data has no length, we certainly do not want to decompress it
- if (lSource == 0) {
- return nullptr;
- }
-
/* This will be the dynamically re-allocated writeable memory stream.
* We do not want it to be deleted from scope, as this location is where
* the readstream being returned will point to.
@@ -146,6 +146,9 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *source, int
oldCode = inCode;
}
+ free(pCodes);
+ free(pTk);
+
/* Return a readstream with a pointer to the data in the write stream.
* This one we do want to dispose after using, because it will be in the scope of the engine itself
*/
More information about the Scummvm-git-logs
mailing list