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 3004 - [patch] Fix IBus leaking memory (D-Bus address filename)
Summary: [patch] Fix IBus leaking memory (D-Bus address filename)
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.4
Depends on:
Blocks:
 
Reported: 2015-06-07 16:27 UTC by Zack Middleton (zturtleman)
Modified: 2015-06-12 16:59 UTC (History)
1 user (show)

See Also:


Attachments
Patch to fix IBus memory leak (364 bytes, patch)
2015-06-07 16:27 UTC, Zack Middleton (zturtleman)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zack Middleton (zturtleman) 2015-06-07 16:27:38 UTC
Created attachment 2172 [details]
Patch to fix IBus memory leak

IBus code does not free the D-Bus address filename in SDL_IBus_Init if the file cannot be read or address not found, causing it to leak memory. It leaks each time the video sub system is (re)started.

The issue occurs in the latest SDL HG revision and was introduced in commit https://hg.libsdl.org/SDL/rev/28c55cb65416 .
Comment 1 Ryan C. Gordon 2015-06-07 21:55:14 UTC
This patch is now https://hg.libsdl.org/SDL/rev/a964d651f1dd, thanks!

--ryan.
Comment 2 Ozkan Sezer 2015-06-12 05:55:50 UTC
The patch looks incorrect to me. The strdup'ed string is ibus_addr_file
and not addr_file, so you actually need the following?

-            SDL_free(addr_file);
+            SDL_free(ibus_addr_file);
Comment 3 Ryan C. Gordon 2015-06-12 16:59:15 UTC
(In reply to Ozkan Sezer from comment #2)
> The patch looks incorrect to me. The strdup'ed string is ibus_addr_file
> and not addr_file, so you actually need the following?
> 
> -            SDL_free(addr_file);
> +            SDL_free(ibus_addr_file);

IBus_GetDBusAddressFilename() returns an allocated string to "addr_file" that we need to free in this failure case. "ibus_addr_file" is a global var we free elsewhere.

This code is nasty in any case, and needs to be cleaned up (it's confusing about who is strdup()'ing what and where, etc), but I'll do that after 2.0.4 ships.

--ryan.