[Scummvm-git-logs] scummvm master -> 46ce5bd51f6e83479ce67a51707db68a3dbb12da

sev- noreply at scummvm.org
Tue Jul 25 04:59:58 UTC 2023


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:
46ce5bd51f DIRECTOR: Fix memory leaks when changing sharedCast


Commit: 46ce5bd51f6e83479ce67a51707db68a3dbb12da
    https://github.com/scummvm/scummvm/commit/46ce5bd51f6e83479ce67a51707db68a3dbb12da
Author: Harishankar Kumar (hari01584 at gmail.com)
Date: 2023-07-25T06:59:54+02:00

Commit Message:
DIRECTOR: Fix memory leaks when changing sharedCast

When changing from shared casts in `Window::loadNewSharedCast`, and in
instance where previousCast need to be deleted, we just deleted the cast
itself but not the underlying `Archive`, this resulted in memory leaks.
`~Director()` was not deleting this archive because it was being removed
from `_allSeenResFiles` in favour of loading new archive.

Fixed by deleting `Archive *_castArchive` of previousCast after erasing
its entry from `_allSeenResFiles`.

Changed paths:
    engines/director/window.cpp


diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 8cae284277c..2442f8d2e9f 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -370,6 +370,7 @@ void Window::loadNewSharedCast(Cast *previousSharedCast) {
 	if (previousSharedCast) {
 		g_director->_allSeenResFiles.erase(previousSharedCastPath);
 		g_director->_allOpenResFiles.remove(previousSharedCastPath);
+		delete previousSharedCast->_castArchive;
 		delete previousSharedCast;
 	}
 




More information about the Scummvm-git-logs mailing list