From 7b887e5b07fde44de448295eaad7d8a2bf1147df Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 14 May 2020 19:36:05 +0900 Subject: [PATCH] Fix memory leak in case of setting prediction hint multiple times Change-Id: Ie663d3e195b29830ccf86ad4e8f33c5b67319a96 Signed-off-by: Jihoon Kim --- ism/extras/wayland_immodule/wayland_imcontext.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 802021f..5cbc499 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -3867,6 +3867,9 @@ wayland_im_context_prediction_hint_set (Ecore_IMF_Context *ctx, const char *pred WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx); if (!imcontext) return; + if (imcontext->prediction_hint) + free(imcontext->prediction_hint); + imcontext->prediction_hint = strdup(prediction_hint ? prediction_hint : ""); if (imcontext->input && imcontext->text_input) { -- 2.7.4