diff --git a/dict/dict.cpp b/dict/dict.cpp index 0dcc7d6c..b61ed24b 100644 --- a/dict/dict.cpp +++ b/dict/dict.cpp @@ -241,11 +241,12 @@ void Dict::Load(const char *data_file_name, const STRING &lang) { if (load_bigram_dawg) { bigram_dawg_ = dawg_cache_->GetSquishedDawg( lang, data_file_name, TESSDATA_BIGRAM_DAWG, dawg_debug_level); + if (bigram_dawg_) dawgs_ += bigram_dawg_; } if (load_freq_dawg) { freq_dawg_ = dawg_cache_->GetSquishedDawg( lang, data_file_name, TESSDATA_FREQ_DAWG, dawg_debug_level); - if (freq_dawg_) { dawgs_ += freq_dawg_; } + if (freq_dawg_) dawgs_ += freq_dawg_; } if (load_unambig_dawg) { unambig_dawg_ = dawg_cache_->GetSquishedDawg( @@ -331,7 +332,6 @@ void Dict::End() { delete dawgs_[i]; } } - dawg_cache_->FreeDawg(bigram_dawg_); if (dawg_cache_is_ours_) { delete dawg_cache_; dawg_cache_ = NULL;