summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-06-17 15:35:01 +0800
committerPeng Wu <alexepico@gmail.com>2013-06-17 15:35:01 +0800
commit77d9412336783469b7cebd37188f644e51f1a5df (patch)
tree09c13de19c38f890216af90e5ef1e74fd94bdf4f /src
parent32071df5b2689e040073ef678bfd6766a26a4efd (diff)
downloadlibpinyin-77d9412336783469b7cebd37188f644e51f1a5df.tar.gz
libpinyin-77d9412336783469b7cebd37188f644e51f1a5df.tar.xz
libpinyin-77d9412336783469b7cebd37188f644e51f1a5df.zip
fixes table info load
Diffstat (limited to 'src')
-rw-r--r--src/storage/table_info.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/storage/table_info.cpp b/src/storage/table_info.cpp
index 1b8ae7a..795d93d 100644
--- a/src/storage/table_info.cpp
+++ b/src/storage/table_info.cpp
@@ -131,16 +131,22 @@ bool SystemTableInfo::load(const char * filename) {
gfloat lambda = 0.;
int num = fscanf(input, "binary format version:%d\n", &binver);
- if (1 != num)
+ if (1 != num) {
+ fclose(input);
return false;
+ }
num = fscanf(input, "model data version:%d\n", &modelver);
- if (1 != num)
+ if (1 != num) {
+ fclose(input);
return false;
+ }
num = fscanf(input, "lambda parameter:%f\n", &lambda);
- if (1 != num)
+ if (1 != num) {
+ fclose(input);
return false;
+ }
#if 0
printf("binver:%d modelver:%d lambda:%f\n", binver, modelver, lambda);
@@ -211,12 +217,16 @@ bool UserTableInfo::load(const char * filename) {
int binver = 0, modelver = 0;
int num = fscanf(input, "binary format version:%d\n", &binver);
- if (1 != num)
+ if (1 != num) {
+ fclose(input);
return false;
+ }
num = fscanf(input, "model data version:%d\n", &modelver);
- if (1 != num)
+ if (1 != num) {
+ fclose(input);
return false;
+ }
#if 0
printf("binver:%d modelver:%d\n", binver, modelver);