aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2008-10-09 11:11:09 -0700
committerIliyan Malchev <malchev@google.com>2008-10-09 14:27:54 -0700
commit72f7ffc1f2b2c8154babc3bedae8afa2e40e7f21 (patch)
tree735e1bbfd4a1f468014b568e1cdfbbb2ed209925
parent4125145ec2a453fa13de515907294391a71c78b7 (diff)
downloadtesseract-72f7ffc1f2b2c8154babc3bedae8afa2e40e7f21.tar.gz
fix a crash in the base-api destructor
Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r--classify/intproto.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/classify/intproto.cpp b/classify/intproto.cpp
index 55c950f..6a233a2 100644
--- a/classify/intproto.cpp
+++ b/classify/intproto.cpp
@@ -836,15 +836,16 @@ INT_CLASS NewIntClass(int MaxNumProtos, int MaxNumConfigs) {
/*-------------------------------------------------------------------------*/
void free_int_class(INT_CLASS int_class) {
- int i;
-
- for (i = 0; i < NumProtoSetsIn (int_class); i++) {
- Efree (ProtoSetIn (int_class, i));
- }
- if (int_class->ProtoLengths != NULL) {
- Efree (int_class->ProtoLengths);
+ if (int_class) {
+ int i;
+ for (i = 0; i < NumProtoSetsIn (int_class); i++) {
+ Efree (ProtoSetIn (int_class, i));
+ }
+ if (int_class->ProtoLengths != NULL) {
+ Efree (int_class->ProtoLengths);
+ }
+ Efree(int_class);
}
- Efree(int_class);
}