Fix defect detected by static anlaysis tool 46/174346/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 30 Mar 2018 07:34:01 +0000 (16:34 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 30 Mar 2018 07:34:01 +0000 (16:34 +0900)
Change-Id: I8dad8766004bf3276e47f8c093eb2a7d4a8ef6ce

ism/extras/wayland_immodule/wayland_imcontext.c

index 43155ac..edfe6b0 100644 (file)
@@ -891,12 +891,13 @@ rotary_event_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
         isf_device_type_e type = find_device_type_from_ecore_event(ECORE_EVENT_DETENT_ROTATE);
         char *buffer = NULL;
         size_t buflen = 0;
+
         if (device_buffer_encode((const char*)(event), sizeof(Ecore_Event_Detent_Rotate), &buffer, &buflen) &&
             buffer && buflen > 0) {
             wl_text_input_process_input_device_event(imcontext->text_input,
                 (unsigned int)type, buffer, buflen);
-            free(buffer);
         }
+        if (buffer) free(buffer);
     }
 
     return EINA_FALSE;