From 7aeba89ce5efa118d3fa45f52becf0eb9729e972 Mon Sep 17 00:00:00 2001 From: "oriahulrich@microvu.com" Date: Thu, 18 Sep 2014 16:43:28 +0100 Subject: [PATCH 1/2] Issue 1316: The traineddata file must be closed after it was opened --- dict/dawg_cache.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dict/dawg_cache.cpp b/dict/dawg_cache.cpp index 4eda23a757..2a6c16c1fa 100644 --- a/dict/dawg_cache.cpp +++ b/dict/dawg_cache.cpp @@ -60,7 +60,10 @@ Dawg *DawgLoader::Load() { if (!data_loader.Init(data_file_name_, dawg_debug_level_)) { return NULL; } - if (!data_loader.SeekToStart(tessdata_dawg_type_)) return NULL; + if (!data_loader.SeekToStart(tessdata_dawg_type_)) { + data_loader.End(); /// Must close the file + return NULL; + } FILE *fp = data_loader.GetDataFilePtr(); DawgType dawg_type; PermuterType perm_type; From 941575b905eb9383fde2d235de119a2d3c050df5 Mon Sep 17 00:00:00 2001 From: Jim O'Regan Date: Wed, 13 May 2015 14:59:02 +0100 Subject: [PATCH 2/2] remove unneeded comment from commit --- dict/dawg_cache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dict/dawg_cache.cpp b/dict/dawg_cache.cpp index 2a6c16c1fa..2d21b01809 100644 --- a/dict/dawg_cache.cpp +++ b/dict/dawg_cache.cpp @@ -61,7 +61,7 @@ Dawg *DawgLoader::Load() { return NULL; } if (!data_loader.SeekToStart(tessdata_dawg_type_)) { - data_loader.End(); /// Must close the file + data_loader.End(); return NULL; } FILE *fp = data_loader.GetDataFilePtr();