mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-12 07:29:07 +08:00
Fix CID 1393238 (Dereference null return value)
Add also some error handling if fopen fails. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
27a5908a55
commit
09976e6125
@ -128,8 +128,12 @@ bool Tesseract::ProcessTargetWord(const TBOX& word_box,
|
||||
if (backup_config_file_ == nullptr) {
|
||||
backup_config_file_ = kBackUpConfigFile;
|
||||
FILE* config_fp = fopen(backup_config_file_, "wb");
|
||||
ParamUtils::PrintParams(config_fp, params());
|
||||
fclose(config_fp);
|
||||
if (config_fp == nullptr) {
|
||||
tprintf("Error, failed to open file \"%s\"\n", backup_config_file_);
|
||||
} else {
|
||||
ParamUtils::PrintParams(config_fp, params());
|
||||
fclose(config_fp);
|
||||
}
|
||||
ParamUtils::ReadParamsFile(word_config,
|
||||
SET_PARAM_CONSTRAINT_DEBUG_ONLY,
|
||||
params());
|
||||
|
Loading…
Reference in New Issue
Block a user