summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-12-05 15:47:48 +0800
committerPeng Wu <alexepico@gmail.com>2011-12-05 15:47:48 +0800
commit75a9c152b835c7e66222e23eba041bb6e09e6dac (patch)
treedfcdbd935a93a38296600f8dfb3b89e9cc426206
parent0b4d5c66a57105ded0aa41ded6ea55c4edac24a7 (diff)
downloadlibpinyin-75a9c152b835c7e66222e23eba041bb6e09e6dac.tar.gz
libpinyin-75a9c152b835c7e66222e23eba041bb6e09e6dac.tar.xz
libpinyin-75a9c152b835c7e66222e23eba041bb6e09e6dac.zip
clean up parse_one_key in full pinyin parser2
-rw-r--r--src/storage/pinyin_parser2.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 7e98b4d..727dc28 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -217,8 +217,10 @@ bool FullPinyinParser2::parse_one_key (pinyin_option_t options, ChewingKey & key
/* Note: optimize here? */
input[parsed_len] = '\0';
- if (!search_pinyin_index(options, input, key, key_rest))
- --parsed_len;
+ if (!search_pinyin_index(options, input, key, key_rest)) {
+ g_free(input);
+ return false;
+ }
if (options & USE_TONE) {
/* post processing tone. */