Commit 699f879a8f46c2ab188ba20f1c1e499439f65707

Ryan C. Gordon 2015-06-07T17:54:39

Fixed a memory leak (thanks, Zack!). We should probably rework this piece of code a little more after 2.0.4 ships, though. Fixes Bugzilla #3004.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c
index 30aadf5..46d602a 100644
--- a/src/core/linux/SDL_ibus.c
+++ b/src/core/linux/SDL_ibus.c
@@ -461,10 +461,12 @@ SDL_IBus_Init(void)
             return SDL_FALSE;
         }
         
+        /* !!! FIXME: if ibus_addr_file != NULL, this will overwrite it and leak (twice!) */
         ibus_addr_file = SDL_strdup(addr_file);
         
         addr = IBus_ReadAddressFromFile(addr_file);
         if (!addr) {
+            SDL_free(addr_file);
             return SDL_FALSE;
         }