From 5326fe3befa3e602aba4a4675c298d8cda1c8321 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 5 Jun 2013 11:33:32 +0900 Subject: [PATCH] fix memory leak issue when ecore_imf_context_surrounding_get is used Change-Id: I407c29da3e58846b3b9f02b5d07eba659437819e --- ism/extras/efl_immodule/isf_imf_context.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ism/extras/efl_immodule/isf_imf_context.cpp b/ism/extras/efl_immodule/isf_imf_context.cpp index 6b0ef124..7790b713 100644 --- a/ism/extras/efl_immodule/isf_imf_context.cpp +++ b/ism/extras/efl_immodule/isf_imf_context.cpp @@ -3721,9 +3721,18 @@ slot_get_surrounding_text (IMEngineInstanceBase *si, if (ecore_imf_context_surrounding_get (_focused_ic->ctx, &surrounding, &cursor_index)) { SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n"; SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n"; - if (cursor_index < 0) + if (cursor_index < 0) { + if (surrounding) { + free (surrounding); + surrounding = NULL; + } return false; + } WideString before = utf8_mbstowcs (String (surrounding)); + if (surrounding) { + free (surrounding); + surrounding = NULL; + } if (cursor_index > (int)before.length()) return false; WideString after = before; -- 2.34.1