From 5049635bc3b6c1e261c57774e79345876644dfa2 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 17 Jun 2013 15:46:24 +0800 Subject: fixes memory leaks --- tests/tests_helper.h | 1 + utils/utils_helper.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tests/tests_helper.h b/tests/tests_helper.h index 4f0869f..431dbc8 100644 --- a/tests/tests_helper.h +++ b/tests/tests_helper.h @@ -39,6 +39,7 @@ static bool load_phrase_index(const pinyin_table_info_t * phrase_files, bool retval = chunk->load(filename); if (!retval) { fprintf(stderr, "open %s failed!\n", binfile); + delete chunk; return false; } diff --git a/utils/utils_helper.h b/utils/utils_helper.h index be4f05f..86d5849 100644 --- a/utils/utils_helper.h +++ b/utils/utils_helper.h @@ -109,6 +109,7 @@ static bool save_phrase_index(const pinyin_table_info_t * phrase_files, bool retval = new_chunk->save(binfile); if (!retval) { fprintf(stderr, "save %s failed.", binfile); + delete new_chunk; return false; } @@ -133,6 +134,7 @@ static bool save_dictionary(const pinyin_table_info_t * phrase_files, bool retval = new_chunk->save(binfile); if (!retval) { fprintf(stderr, "save %s failed.", binfile); + delete new_chunk; return false; } -- cgit