Skip to content

Keep the loader output pointer unchanged when initialization fails - #14

Open
Solessfir wants to merge 1 commit into
GothicKit:mainfrom
Solessfir:fix-loader-initialization
Open

Solessfir wants to merge 1 commit into
GothicKit:mainfrom
Solessfir:fix-loader-initialization

Conversation

@Solessfir

@Solessfir Solessfir commented Sep 10, 2026 •

Copy link
Copy Markdown

If mtx_init fails, DmLoader_create frees the new loader but leaves the caller's output pointer pointing to freed memory. Later resolver registration or release can then access that allocation.

Assign the output pointer only after initialization succeeds. Allocation and mutex initialization failures now leave it unchanged.

Found while investigating an OpenGothic Android shutdown crash. The startup log reported loader creation failure without its result code; the mutex failure path was identified by inspecting the code. This is the library fix suggested in Try/OpenGothic#985.

Validation: dmusic static Release build passed with MSVC.

This branch has not been deployed

No deployments
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.

1 participant