ecore_imf: Fix memory leak in scim immodule

This commit is contained in:
Jihoon Kim 2013-09-12 11:49:06 +09:00
parent bd4d6cb6cc
commit 6ff49dbc70
3 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2013-09-06 Jihoon Kim
* ecore_imf: Fix memory leak in scim immodule
2013-09-06 Cedric Bail
* Edje: Add border information to Image sets.

1
NEWS
View File

@ -378,6 +378,7 @@ Fixes:
- Check the state of last mouse event more properly.
* Ecore-imf:
- Fix crash when ecore_imf_context_del is called in ecore_imf_context_input_panel_callback_call.
- Fix memory leak in scim immodule
* Eio:
- Don't leak fd on exec.
- eio functions no longer crash when passed NULL and throw errors accordingly.

View File

@ -2721,8 +2721,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();