We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4756 - Memory leak in SDL_IBus_Init
Summary: Memory leak in SDL_IBus_Init
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.10
Hardware: x86_64 Linux
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-08 15:47 UTC by alexander.grund
Modified: 2019-08-08 15:47 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alexander.grund 2019-08-08 15:47:14 UTC
When the IBUS initialization fails a string is leaked:

        ibus_addr_file = SDL_strdup(addr_file); // Allocate memory

        addr = IBus_ReadAddressFromFile(addr_file);
        if (!addr) {
            SDL_free(addr_file);
            return SDL_FALSE; // This will make the SDL_IBus_Quit not called hence ibus_addr_file is not freed
        }

Possible solution: Move the ibus_addr_file assignment to the bottom and make it conditional on result (only copy if true)

Found via LSAN after a simple SDL_InitVideo(); SDL_Quit(); from inside dynamically loaded shared library.