diff options
author | Peng Wu <alexepico@gmail.com> | 2020-02-26 16:18:53 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2020-02-26 18:46:05 +0800 |
commit | 915f2ff1d5f58b43ef2167a94e3060c342f7abe7 (patch) | |
tree | 4b77f88c045c0de4833cd78cfb538aa2072777a7 | |
parent | 7be9b52ba5ef951d48de960d36d0c015d7d50cd8 (diff) | |
download | ibus-libpinyin-915f2ff1d5f58b43ef2167a94e3060c342f7abe7.tar.gz ibus-libpinyin-915f2ff1d5f58b43ef2167a94e3060c342f7abe7.tar.xz ibus-libpinyin-915f2ff1d5f58b43ef2167a94e3060c342f7abe7.zip |
fixes memory leak in pinyin_get_sentence call
-rw-r--r-- | src/PYPBopomofoEditor.cc | 2 | ||||
-rw-r--r-- | src/PYPLibPinyinCandidates.cc | 2 | ||||
-rw-r--r-- | src/PYPPinyinEditor.cc | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc index dafc3cc..f7a7223 100644 --- a/src/PYPBopomofoEditor.cc +++ b/src/PYPBopomofoEditor.cc @@ -394,6 +394,8 @@ BopomofoEditor::updatePreeditText () guint cursor = getPinyinCursor (); pinyin_get_character_offset(m_instance, sentence, cursor, &offset); Editor::updatePreeditText (preedit_text, offset, TRUE); + + g_free (sentence); } void diff --git a/src/PYPLibPinyinCandidates.cc b/src/PYPLibPinyinCandidates.cc index f404293..f2938bd 100644 --- a/src/PYPLibPinyinCandidates.cc +++ b/src/PYPLibPinyinCandidates.cc @@ -111,6 +111,7 @@ LibPinyinCandidates::selectCandidate (EnhancedCandidate & enhanced) if (m_editor->m_config.rememberEveryInput ()) LibPinyinBackEnd::instance ().rememberUserInput (instance, str); LibPinyinBackEnd::instance ().modified(); + g_free (str); return SELECT_CANDIDATE_COMMIT; } @@ -128,6 +129,7 @@ LibPinyinCandidates::selectCandidate (EnhancedCandidate & enhanced) if (m_editor->m_config.rememberEveryInput ()) LibPinyinBackEnd::instance ().rememberUserInput (instance, str); LibPinyinBackEnd::instance ().modified (); + g_free (str); return SELECT_CANDIDATE_MODIFY_IN_PLACE|SELECT_CANDIDATE_COMMIT; } diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc index fc271e8..fc9ad71 100644 --- a/src/PYPPinyinEditor.cc +++ b/src/PYPPinyinEditor.cc @@ -266,6 +266,8 @@ PinyinEditor::updatePreeditText () guint cursor = getPinyinCursor (); pinyin_get_character_offset(m_instance, sentence, cursor, &offset); Editor::updatePreeditText (preedit_text, offset, TRUE); + + g_free (sentence); } #if 0 |