Memory leak in SDL_IBus_Init

Bug #1839447 reported by Alex G
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libsdl2 (Ubuntu)
New
Undecided
Unassigned

Bug Description

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.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.