fix issue 1018, 1031

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@918 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
zdenop 2013-12-06 22:07:46 +00:00
parent bf0a83907b
commit 38b25b5777
10 changed files with 15 additions and 4 deletions

View File

@ -26,7 +26,6 @@
class BlamerBundle;
class C_BLOB_IT;
class PBLOB_IT;
class PAGE_RES;
class PAGE_RES_IT;
class WERD;

View File

@ -26,7 +26,6 @@
class BLOCK;
class DENORM;
class PBLOB_LIST;
struct TWERD;
class UNICHARSET;
class WERD;

View File

@ -97,7 +97,6 @@ void OtsuThreshold(const unsigned char* imagedata,
}
}
}
delete[] histogramAllChannels;
#else
for (int ch = 0; ch < bytes_per_pixel; ++ch) {
@ -136,6 +135,7 @@ void OtsuThreshold(const unsigned char* imagedata,
}
}
#endif // USE_OPENCL
delete[] histogramAllChannels;
if (!any_good_hivalue) {
// Use the best of the ones that were not good enough.

View File

@ -1689,7 +1689,10 @@ UNICHAR_ID *Classify::GetAmbiguities(TBLOB *Blob,
TrainingSample* sample =
BlobToTrainingSample(*Blob, classify_nonlinear_norm, &fx_info,
&bl_features);
if (sample == NULL) return NULL;
if (sample == NULL) {
delete Results;
return NULL;
}
CharNormClassifier(Blob, *sample, Results);
delete sample;

View File

@ -415,6 +415,7 @@ bool MasterTrainer::LoadXHeights(const char* filename) {
if (xheights_[i] < 0)
xheights_[i] = mean_xheight;
}
fclose(f);
return true;
} // LoadXHeights

View File

@ -100,14 +100,17 @@ CharSampSet * CharSampSet::FromCharDumpFile(string file_name) {
}
// read and verify marker
if (fread(&val32, 1, sizeof(val32), fp) != sizeof(val32)) {
fclose(fp);
return NULL;
}
if (val32 != 0xfefeabd0) {
fclose(fp);
return NULL;
}
// create an object
CharSampSet *samp_set = new CharSampSet();
if (samp_set == NULL) {
fclose(fp);
return NULL;
}
if (samp_set->LoadCharSamples(fp) == false) {

View File

@ -210,6 +210,7 @@ ConComp **ConComp::Segment(int max_hist_wnd, int *concomp_cnt) {
// no segments, nothing to do
if (seg_pt_cnt == 0) {
delete []x_seg_pt;
return NULL;
}

View File

@ -689,6 +689,7 @@ bool CubeLineSegmenter::LineSegment() {
// get the pix and box corresponding to the column
Pix *pixt3 = pixaGetPix(pixad, col, L_CLONE);
if (pixt3 == NULL) {
delete []col_order;
return false;
}
@ -697,6 +698,7 @@ bool CubeLineSegmenter::LineSegment() {
Pixa *pixac;
Boxa *boxa2 = pixConnComp(pixt3, &pixac, 8);
if (boxa2 == NULL) {
delete []col_order;
return false;
}
@ -709,6 +711,7 @@ bool CubeLineSegmenter::LineSegment() {
// add the lines
if (AddLines(pixac) == true) {
if (pixaaAddBox(columns_, col_box, L_CLONE) != 0) {
delete []col_order;
return false;
}
}

View File

@ -328,6 +328,7 @@ static ds_status readProFile(const char* fileName, char** content, size_t* conte
rewind(input);
binary = (char*)malloc(size);
if(binary == NULL) {
fclose(input);
return DS_FILE_ERROR;
}
fread(binary, sizeof(char), size, input);

View File

@ -601,6 +601,7 @@ bool LanguageModel::AddViterbiStateEntry(
tprintf("Language model components very early pruned this entry\n");
}
delete ngram_info;
delete dawg_info;
return false;
}