diff --git a/src/Lib/terragear/tg_chopper.cxx b/src/Lib/terragear/tg_chopper.cxx index 0206373b..7606d7a9 100644 --- a/src/Lib/terragear/tg_chopper.cxx +++ b/src/Lib/terragear/tg_chopper.cxx @@ -165,15 +165,17 @@ long int tgChopper::GenerateIndex( std::string path ) if ( fread( (void*)&index, sizeof(long int), 1, fp ) != 1 ) { SG_LOG(SG_GENERAL, SG_ALERT, "Error reading Index file " << index_file << " abort"); + fclose( fp ); boost::interprocess::named_mutex::remove("tgChopper_index2"); exit(0); } + + rewind( fp ); } index++; - - rewind( fp ); fwrite( (void*)&index, sizeof(long int), 1, fp ); + fclose( fp ); } diff --git a/src/Prep/Cliff/cliff-decode.cxx b/src/Prep/Cliff/cliff-decode.cxx index 397b6c8b..3c2a0198 100644 --- a/src/Prep/Cliff/cliff-decode.cxx +++ b/src/Prep/Cliff/cliff-decode.cxx @@ -185,7 +185,7 @@ void processLayer(OGRLayer* poLayer, tgChopper& results ) char* srsWkt; oSourceSRS->exportToWkt(&srsWkt); SG_LOG( SG_GENERAL, SG_DEBUG, "Source spatial reference system: " << srsWkt ); - OGRFree(srsWkt); + CPLFree(srsWkt); oTargetSRS.SetWellKnownGeogCS( "WGS84" ); @@ -417,6 +417,7 @@ int main( int argc, char **argv ) { } GDALClose(poDS); + GDALDestroyDriverManager(); SG_LOG(SG_GENERAL, SG_ALERT, "Saving to buckets"); results.Add_Extension("cliffs"); diff --git a/src/Prep/GDALChop/gdalchop.cxx b/src/Prep/GDALChop/gdalchop.cxx index a89f7bee..7bdc26ae 100644 --- a/src/Prep/GDALChop/gdalchop.cxx +++ b/src/Prep/GDALChop/gdalchop.cxx @@ -532,6 +532,8 @@ int main(int argc, const char **argv) } } + GDALDestroyDriverManager(); + auto finish_time = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = finish_time - start_time; std::cout << std::endl << "Elapsed time: " << elapsed.count() << " seconds" << std::endl << std::endl; diff --git a/src/Prep/OGRDecode/ogr-decode.cxx b/src/Prep/OGRDecode/ogr-decode.cxx index bff89797..6d61e158 100644 --- a/src/Prep/OGRDecode/ogr-decode.cxx +++ b/src/Prep/OGRDecode/ogr-decode.cxx @@ -459,6 +459,7 @@ void processLayer(OGRLayer* poLayer, tgChopper& results ) SG_LOG( SG_GENERAL, SG_ALERT, "Error in query expression '" << attribute_query << "'" ); if (!continue_on_errors) { SG_LOG( SG_GENERAL, SG_ALERT, "Aborting!" ); + OCTDestroyCoordinateTransformation ( poCT ); exit( 1 ); } else