ecore_imf: check return value of memory allocation 06/141506/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 1 Aug 2017 01:27:37 +0000 (10:27 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 1 Aug 2017 04:30:14 +0000 (04:30 +0000)
Change-Id: Id18c686d06d91c75a615b3ebaab99b9467190c0f
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/lib/ecore_imf/ecore_imf_context.c
src/lib/ecore_imf/ecore_imf_module.c

index d0708e1..4f22548 100644 (file)
@@ -639,6 +639,8 @@ ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx)
      }
 
    ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Start));
+   EINA_SAFETY_ON_NULL_RETURN(ev);
+
    ev->ctx = ctx;
    ecore_event_add(ECORE_IMF_EVENT_PREEDIT_START,
                    ev, _ecore_imf_event_free_preedit, NULL);
@@ -657,6 +659,8 @@ ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx)
      }
 
    ev = malloc(sizeof(Ecore_IMF_Event_Preedit_End));
+   EINA_SAFETY_ON_NULL_RETURN(ev);
+
    ev->ctx = ctx;
    ecore_event_add(ECORE_IMF_EVENT_PREEDIT_END,
                    ev, _ecore_imf_event_free_preedit, NULL);
@@ -675,6 +679,8 @@ ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx)
      }
 
    ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Changed));
+   EINA_SAFETY_ON_NULL_RETURN(ev);
+
    ev->ctx = ctx;
    ecore_event_add(ECORE_IMF_EVENT_PREEDIT_CHANGED,
                    ev, _ecore_imf_event_free_preedit, NULL);
@@ -703,6 +709,8 @@ ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str)
      }
 
    ev = malloc(sizeof(Ecore_IMF_Event_Commit));
+   EINA_SAFETY_ON_NULL_RETURN(ev);
+
    ev->ctx = ctx;
    ev->str = str ? strdup(str) : NULL;
    ecore_event_add(ECORE_IMF_EVENT_COMMIT,
@@ -1442,4 +1450,4 @@ ecore_imf_context_input_panel_position_set(Ecore_IMF_Context *ctx, int x, int y)
 
    if (ctx->klass->input_panel_position_set)
      ctx->klass->input_panel_position_set(ctx, x, y);
-}
\ No newline at end of file
+}
index 990bb71..fdd1cb8 100644 (file)
@@ -235,6 +235,8 @@ ecore_imf_module_register(const Ecore_IMF_Context_Info *info,
      modules = eina_hash_string_superfast_new(EINA_FREE_CB(_ecore_imf_module_free));
 
    module = malloc(sizeof(Ecore_IMF_Module));
+   EINA_SAFETY_ON_NULL_RETURN(module);
+
    module->info = info;
    /* cache imf_module_create as it may be used several times */
    module->create = imf_module_create;