jihoon pushed a commit to branch ecore-1.7.

commit 72fe9ed09b48cd291237c1669f4f41c382948e08
Author: Jihoon Kim <[email protected]>
Date:   Fri Sep 13 10:53:01 2013 +0900

    ecore_imf: Fix memory leak in scim immodule
---
 ChangeLog                                     |  4 ++++
 NEWS                                          | 11 +++++++++++
 src/modules/immodules/scim/scim_imcontext.cpp | 14 ++++++++++++++
 3 files changed, 29 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 85c2e6f..916e5d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1196,3 +1196,7 @@
 2013-08-02  Eduardo Lima (Etrunko)
 
         * 1.7.8 release
+
+2013-09-12  Jihoon Kim (jihoon)
+
+        * ecore_imf: Fix memory leak in scim immodule
diff --git a/NEWS b/NEWS
index b961758..295176d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,14 @@
+Ecore 1.7.9
+
+Changes since Ecore 1.7.8:
+--------------------------
+Additions:
+
+Deprecations:
+
+Fixes:
+    * ecore_imf: Fix memory leak in scim immodule
+
 Ecore 1.7.8
 
 Changes since Ecore 1.7.7:
diff --git a/src/modules/immodules/scim/scim_imcontext.cpp 
b/src/modules/immodules/scim/scim_imcontext.cpp
index d4d20b1..64d1ebc 100644
--- a/src/modules/immodules/scim/scim_imcontext.cpp
+++ b/src/modules/immodules/scim/scim_imcontext.cpp
@@ -2818,8 +2818,22 @@ slot_get_surrounding_text(IMEngineInstanceBase *si,
           {
              SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding 
<<"\n";
              SCIM_DEBUG_FRONTEND(2) << "Cursor Index    : " << cursor_index 
<<"\n";
+             if (!surrounding)
+               return false;
+
+             if (cursor_index < 0)
+               {
+                  free(surrounding);
+                  surrounding = NULL;
+                  return false;
+               }
+
              WideString before(utf8_mbstowcs(String(surrounding, surrounding + 
cursor_index)));
              WideString after(utf8_mbstowcs(String(surrounding + 
cursor_index)));
+
+             free(surrounding);
+             surrounding = NULL;
+
              if (maxlen_before > 0 && ((unsigned int)maxlen_before) < 
before.length())
                before = WideString(before.begin() + (before.length() - 
maxlen_before), before.end());
              else if (maxlen_before == 0) before = WideString();

-- 

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk

Reply via email to