From de80a48fc33b6229e6b91f90eb09f54b46baf3aa Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Fri, 28 Jun 2013 07:57:34 +0100 Subject: [PATCH] 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 --- 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 f28170292..7dbf2b126 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