ime: free allocated variables before return statement
[platform/core/uifw/libds-tizen.git] / src / input_method / input_method.c
index 8eed2f2..138193f 100644 (file)
@@ -221,8 +221,10 @@ ds_tizen_input_method_create_context(struct ds_tizen_input_method *input_method)
 
     ds_inf("ds_tizen_input_method_create_context");
     context = calloc(1, sizeof *context);
-    if (context == NULL)
+    if (context == NULL) {
+        ds_err("calloc() failed. ds_tizen_input_method_context");
         return NULL;
+    }
 
     binding = input_method->resource;
     if (!binding) return NULL;
@@ -230,6 +232,7 @@ ds_tizen_input_method_create_context(struct ds_tizen_input_method *input_method)
             &zwp_input_method_context_v1_interface, INPUT_METHOD_VERSION, 0);
     if (context->resource == NULL) {
         ds_err("context. wl_resource_create() failed.");
+        free(context);
         return NULL;
     }
     wl_resource_set_implementation(context->resource, &context_impl,