From: Jihoon Kim Date: Wed, 23 Dec 2015 02:27:20 +0000 (+0900) Subject: Fix dereference of NULL X-Git-Tag: submit/tizen/20151223.023226~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=059a30c44ec0a6bbbc42f858dfcc1a59835bb220;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-wl-textinput.git Fix dereference of NULL Pointer 'resource', which is passed as 1st parameter in call to function 'wl_resource_set_implementation' at e_mod_main.c:1161, where it is dereferenced at wayland-server.c:1291, may have NULL value. Change-Id: If0265f777d8d73e9cd59e1ff2fc6e0ef67e1da43 --- diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 95e7e3a..fb107ec 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1155,8 +1155,6 @@ _e_text_cb_bind_input_method(struct wl_client *client, void *data, uint32_t vers if (!input_method) return; - resource = wl_resource_create(client, &wl_input_method_interface, 1, id); - if (input_method->resource) { wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -1164,10 +1162,15 @@ _e_text_cb_bind_input_method(struct wl_client *client, void *data, uint32_t vers return; } + resource = wl_resource_create(client, &wl_input_method_interface, 1, id); + input_method->resource = resource; - wl_resource_set_implementation(resource, NULL, input_method, - _e_text_input_method_cb_unbind); + if (resource) + { + wl_resource_set_implementation(resource, NULL, input_method, + _e_text_input_method_cb_unbind); + } } static void