Skip to content

Commit

Permalink
fix issue 1018, 1031
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@918 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
zdenop committed Dec 6, 2013
1 parent bf0a839 commit 38b25b5
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 4 deletions.
1 change: 0 additions & 1 deletion ccmain/pageiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

class BlamerBundle;
class C_BLOB_IT;
class PBLOB_IT;
class PAGE_RES;
class PAGE_RES_IT;
class WERD;
Expand Down
1 change: 0 additions & 1 deletion ccstruct/boxword.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

class BLOCK;
class DENORM;
class PBLOB_LIST;
struct TWERD;
class UNICHARSET;
class WERD;
Expand Down
2 changes: 1 addition & 1 deletion ccstruct/otsuthr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ void OtsuThreshold(const unsigned char* imagedata,
}
}
}
delete[] histogramAllChannels;
#else

for (int ch = 0; ch < bytes_per_pixel; ++ch) {
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion classify/adaptmatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions classify/mastertrainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ bool MasterTrainer::LoadXHeights(const char* filename) {
if (xheights_[i] < 0)
xheights_[i] = mean_xheight;
}
fclose(f);
return true;
} // LoadXHeights

Expand Down
3 changes: 3 additions & 0 deletions cube/char_samp_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions cube/con_comp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions cube/cube_line_segmenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -697,6 +698,7 @@ bool CubeLineSegmenter::LineSegment() {
Pixa *pixac;
Boxa *boxa2 = pixConnComp(pixt3, &pixac, 8);
if (boxa2 == NULL) {
delete []col_order;
return false;
}

Expand All @@ -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;
}
}
Expand Down
1 change: 1 addition & 0 deletions opencl/opencl_device_selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions wordrec/language_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 38b25b5

Please sign in to comment.