From 81656fd4233409b150386d86fc680a112eea25e6 Mon Sep 17 00:00:00 2001 From: cvs Date: Sat, 25 Mar 2006 14:16:56 +0000 Subject: [PATCH] Remove handle ( and memory ) leak --- src/Prep/ShapeFile/shape-decode.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Prep/ShapeFile/shape-decode.cxx b/src/Prep/ShapeFile/shape-decode.cxx index 2054d34c..72b68d62 100644 --- a/src/Prep/ShapeFile/shape-decode.cxx +++ b/src/Prep/ShapeFile/shape-decode.cxx @@ -548,6 +548,7 @@ int main( int argc, char **argv ) { if (psShape->nSHPType==0) { SG_LOG( SG_GENERAL, SG_DEBUG, "Skipping NULL record " << i); + SHPDestroyObject( psShape ); continue; } @@ -559,9 +560,10 @@ int main( int argc, char **argv ) { SG_LOG( SG_GENERAL, SG_ALERT, "Record with negative part count, " "file may be corrupted!"); - if (continue_on_errors) + if (continue_on_errors) { + SHPDestroyObject( psShape ); continue; - else + } else exit(-1); } @@ -573,9 +575,10 @@ int main( int argc, char **argv ) { SG_LOG( SG_GENERAL, SG_ALERT, "Non-point record with zero part count, " "file may be corrupted!"); - if (continue_on_errors) + if (continue_on_errors) { + SHPDestroyObject( psShape ); continue; - else + } else exit(-1); } @@ -621,6 +624,7 @@ int main( int argc, char **argv ) { // Ocean data now comes from GSHHS so we want to ignore // all other ocean data + SHPDestroyObject( psShape ); continue; } else if ( area == VoidArea ) { // interior is ???? @@ -632,7 +636,7 @@ int main( int argc, char **argv ) { SG_LOG( SG_GENERAL, SG_ALERT, " Void area with holes!" ); // exit(-1); } - + SHPDestroyObject( psShape ); continue; } else if ( area == NullArea ) { // interior is ???? @@ -644,7 +648,7 @@ int main( int argc, char **argv ) { SG_LOG( SG_GENERAL, SG_ALERT, " Null area with holes!" ); // exit(-1); } - + SHPDestroyObject( psShape ); continue; }