jihoon pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=15250fb8cf63728d9b9ae073b7ae5085526c61ca

commit 15250fb8cf63728d9b9ae073b7ae5085526c61ca
Author: Jihoon Kim <[email protected]>
Date:   Tue Aug 1 10:27:37 2017 +0900

    ecore_imf: check return value of memory allocation
    
    Signed-off-by: Jihoon Kim <[email protected]>
---
 src/lib/ecore_imf/ecore_imf_context.c | 10 +++++++++-
 src/lib/ecore_imf/ecore_imf_module.c  |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore_imf/ecore_imf_context.c 
b/src/lib/ecore_imf/ecore_imf_context.c
index 2ac7d59e7f..caa2d59f1b 100644
--- a/src/lib/ecore_imf/ecore_imf_context.c
+++ b/src/lib/ecore_imf/ecore_imf_context.c
@@ -649,6 +649,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);
@@ -667,6 +669,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);
@@ -685,6 +689,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);
@@ -713,6 +719,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,
@@ -1436,4 +1444,4 @@ ecore_imf_context_mime_type_accept_set(Ecore_IMF_Context 
*ctx, const char *mime_
 
    if (ctx->klass->mime_type_accept_set)
      ctx->klass->mime_type_accept_set(ctx, mime_type);
-}
\ No newline at end of file
+}
diff --git a/src/lib/ecore_imf/ecore_imf_module.c 
b/src/lib/ecore_imf/ecore_imf_module.c
index 3fec5de1d6..814152f79b 100644
--- a/src/lib/ecore_imf/ecore_imf_module.c
+++ b/src/lib/ecore_imf/ecore_imf_module.c
@@ -306,6 +306,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;

-- 


Reply via email to