Skip to content

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Oct 19, 2025

When twin_sdl_init() fails after successful SDL_Init() but before completion (e.g., SDL_CreateWindow fails), the SDL subsystem is not properly cleaned up, leaking system resources.

The bail chain was missing SDL_Quit() cleanup. Error paths jumped directly to 'bail' label which only freed memory, leaving SDL initialized.


Summary by cubic

Properly shuts down SDL when twin_sdl_init fails, preventing a resource leak after SDL_Init succeeds but window creation fails.

  • Bug Fixes
    • Added SDL_Quit() to the error path via a new bail_sdl label.
    • Redirected SDL_CreateWindow failure to bail_sdl instead of bail.

When twin_sdl_init() fails after successful SDL_Init() but before
completion (e.g., SDL_CreateWindow fails), the SDL subsystem is not
properly cleaned up, leaking system resources.

The bail chain was missing SDL_Quit() cleanup. Error paths jumped
directly to 'bail' label which only freed memory, leaving SDL
initialized.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@jserv jserv merged commit a328f78 into main Oct 19, 2025
9 checks passed
@jserv jserv deleted the fix-sdl-cleanup branch October 19, 2025 09:31
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