devilhorns pushed a commit to branch master.

commit de80a48fc33b6229e6b91f90eb09f54b46baf3aa
Author: Chris Michael <[email protected]>
Date:   Fri Jun 28 07:57:34 2013 +0100

    When we unbind the data device or input device, we do not need to call
    free().
    Free the allocated strings after creating the keymap (leak--).
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/bin/e_comp_wl.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index f281702..7dbf2b1 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -1122,7 +1122,6 @@ static void
 _unbind_data_device(struct wl_resource *resource)
 {
    wl_list_remove(wl_resource_get_link(resource));
-   free(resource);
 }
 
 static void
@@ -1886,16 +1885,14 @@ static void
 _e_comp_wl_input_cb_unbind(struct wl_resource *resource)
 {
    /* remove the link */
-   wl_list_remove(&resource->link);
-
-   /* free the resource */
-   free(resource);
+   wl_list_remove(wl_resource_get_link(resource));
 }
 
 static struct xkb_keymap *
 _e_comp_wl_input_keymap_get(void)
 {
    E_Config_XKB_Layout *kbd_layout;
+   struct xkb_keymap *keymap;
    struct xkb_rule_names names;
 
    memset(&names, 0, sizeof(names));
@@ -1945,7 +1942,13 @@ _e_comp_wl_input_keymap_get(void)
    printf("\tModel: %s\n", names.model);
    printf("\tLayout: %s\n", names.layout);
 
-   return xkb_map_new_from_names(_e_wl_comp->xkb.context, &names, 0);
+   keymap = xkb_map_new_from_names(_e_wl_comp->xkb.context, &names, 0);
+
+   free((char *)names.rules);
+   free((char *)names.model);
+   free((char *)names.layout);
+
+   return keymap;
 }
 
 static int 

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to