diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2017-08-12 10:23:01 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2017-08-12 10:24:36 +0900 |
commit | 723dfaebd1353cc46eeedbbb85ccbe3e70ec1b92 (patch) | |
tree | f2dcb6ef201a4a2fb9f3cd0a9ab2f6fde2acbfc8 | |
parent | e40435a1b056ed811a9998d1ef5aa838e55182ea (diff) | |
download | efl-723dfaebd1353cc46eeedbbb85ccbe3e70ec1b92.tar.gz |
ecore_imf/wayland: Check the return value of memory allocation function
-rw-r--r-- | src/modules/ecore_imf/wayland/wayland_imcontext.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/modules/ecore_imf/wayland/wayland_imcontext.c b/src/modules/ecore_imf/wayland/wayland_imcontext.c index ad9b614050..24742080bf 100644 --- a/src/modules/ecore_imf/wayland/wayland_imcontext.c +++ b/src/modules/ecore_imf/wayland/wayland_imcontext.c @@ -518,6 +518,7 @@ text_input_preedit_styling(void *data, { WaylandIMContext *imcontext = (WaylandIMContext *)data; Ecore_IMF_Preedit_Attr *attr = calloc(1, sizeof(*attr)); + if (!attr) return; switch (style) { @@ -864,8 +865,11 @@ wayland_im_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, EINA_LIST_FOREACH(imcontext->preedit_attrs, l, a) { attr = malloc(sizeof(*attr)); - attr = memcpy(attr, a, sizeof(*attr)); - *attrs = eina_list_append(*attrs, attr); + if (attr) + { + attr = memcpy(attr, a, sizeof(*attr)); + *attrs = eina_list_append(*attrs, attr); + } } } @@ -1101,9 +1105,11 @@ WaylandIMContext * wayland_im_context_new(struct zwp_text_input_manager_v1 *text_input_manager) { WaylandIMContext *context = calloc(1, sizeof(WaylandIMContext)); - - EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "new context created"); - context->text_input_manager = text_input_manager; + if (context) + { + EINA_LOG_DOM_INFO(_ecore_imf_wayland_log_dom, "new context created"); + context->text_input_manager = text_input_manager; + } return context; } |