clean up parse_one_key in full pinyin parser2
authorPeng Wu <alexepico@gmail.com>
Mon, 5 Dec 2011 07:47:48 +0000 (15:47 +0800)
committerPeng Wu <alexepico@gmail.com>
Mon, 5 Dec 2011 07:47:48 +0000 (15:47 +0800)
src/storage/pinyin_parser2.cpp

index 7e98b4d..727dc28 100644 (file)
@@ -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. */