From 41239dbf4e2f3c81de79a0d2650da8b247ae04bd Mon Sep 17 00:00:00 2001 From: Inhong Han Date: Tue, 16 Oct 2018 18:26:16 +0900 Subject: [PATCH] Prevent Segmentation fault Change-Id: Ic68d72896aa32c2573fa9c540571a813d66ade14 (cherry picked from commit cc321f17c4629729f9229af4ed40c4a5af9fd291) --- ism/extras/wayland_immodule/wayland_imcontext.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 4f50b28..bde1b04 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -1221,7 +1221,10 @@ check_serial(WaylandIMContext *imcontext, uint32_t serial) imcontext->pending_preedit.cursor = 0; if (imcontext->pending_preedit.attrs) { - EINA_LIST_FREE(imcontext->pending_preedit.attrs, attr) free(attr); + EINA_LIST_FREE(imcontext->pending_preedit.attrs, attr) { + if (attr) + free(attr); + } imcontext->pending_preedit.attrs = NULL; } @@ -1245,8 +1248,10 @@ clear_preedit_text(WaylandIMContext *imcontext) } if (imcontext->preedit_attrs) { - EINA_LIST_FREE(imcontext->preedit_attrs, attr) - free(attr); + EINA_LIST_FREE(imcontext->preedit_attrs, attr) { + if (attr) + free(attr); + } } imcontext->preedit_attrs = NULL; @@ -2911,7 +2916,8 @@ wayland_im_context_del (Ecore_IMF_Context *ctx) clear_preedit (imcontext); EINA_LIST_FREE(imcontext->keysym_list, ev) { - free(ev); + if (ev) + free(ev); } free(imcontext); -- 2.7.4