X Tutup
Skip to content

BASE: Fix MetaEngine leak in runGame#6619

Merged
criezy merged 1 commit intoscummvm:masterfrom
tunnelsociety:rungame-cleanonerror
May 14, 2025
Merged

BASE: Fix MetaEngine leak in runGame#6619
criezy merged 1 commit intoscummvm:masterfrom
tunnelsociety:rungame-cleanonerror

Conversation

@tunnelsociety
Copy link
Contributor

@tunnelsociety tunnelsociety commented May 14, 2025

metaEngine could have been issued createInstance but not deleteInstance if an engine failed to instantiate (e.g. if user cancels start of a not-fully-supported game).

image

Attempts to fix:

=================================================================
==35138==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 496 byte(s) in 1 object(s) allocated from:
    #0 in operator new(unsigned long) (scummvm/scummvm+0x17faead) (BuildId: 7d084231cb059720)
    #1 in AdvancedMetaEngineDetection<Nancy::NancyGameDescription>::identifyGame(DetectedGame&, void const**) scummvm/engines/advancedDetector.h:616:18
    #2 in identifyGame(Common::String const&, Plugin const**, DetectedGame&, void const**) scummvm/base/main.cpp:164:36
    #3 in scummvm_main scummvm/base/main.cpp:748:26
    #4 in main scummvm/backends/platform/sdl/posix/posix-main.cpp:44:12
    #5 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #6 in __libc_start_main csu/../csu/libc-start.c:360:3
    #7 in _start (scummvm/scummvm+0x173d210) (BuildId: 7d084231cb059720)

Indirect leak of 198 byte(s) in 1 object(s) allocated from:
    #0 in operator new[](unsigned long) (scummvm/scummvm+0x17fafbd) (BuildId: 7d084231cb059720)
    #1 in ADDynamicGameDescription<Nancy::NancyGameDescription>::ADDynamicGameDescription(Nancy::NancyGameDescription const*) scummvm/engines/advancedDetector.h:280:13
    #2 in AdvancedMetaEngineDetection<Nancy::NancyGameDescription>::identifyGame(DetectedGame&, void const**) scummvm/engines/advancedDetector.h:616:22
    #3 in identifyGame(Common::String const&, Plugin const**, DetectedGame&, void const**) scummvm/base/main.cpp:164:36
    #4 in scummvm_main scummvm/base/main.cpp:748:26
    #5 in main scummvm/backends/platform/sdl/posix/posix-main.cpp:44:12
    #6 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #7 in __libc_start_main csu/../csu/libc-start.c:360:3
    #8 in _start (scummvm/scummvm+0x173d210) (BuildId: 7d084231cb059720)

SUMMARY: AddressSanitizer: 694 byte(s) leaked in 2 allocation(s).

metaEngine could have been issued createInstance but not deleteInstance
if an engine failed to instantiate (e.g. if user cancels start of a
not-fully-supported game).
@criezy
Copy link
Member

criezy commented May 14, 2025

Good catch. Thank you.

@criezy criezy merged commit fe142ed into scummvm:master May 14, 2025
8 checks passed
@tunnelsociety tunnelsociety deleted the rungame-cleanonerror branch May 19, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup