Genapts: fix memory leaks
This commit is contained in:
parent
a61df8aec0
commit
b1dd1d9e36
3 changed files with 13 additions and 11 deletions
|
@ -350,8 +350,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
TG_LOG(SG_GENERAL, SG_INFO, "Done");
|
||||
exit(0);
|
||||
TG_LOG(SG_GENERAL, SG_INFO, "Genapts finished successfully");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ bool Parser::GetAirportDefinition( char* line, std::string& icao )
|
|||
{
|
||||
char* tok;
|
||||
int code;
|
||||
Airport* airport = NULL;
|
||||
bool match = false;
|
||||
|
||||
// Get the number code
|
||||
|
@ -26,9 +25,11 @@ bool Parser::GetAirportDefinition( char* line, std::string& icao )
|
|||
case LAND_AIRPORT_CODE:
|
||||
case SEA_AIRPORT_CODE:
|
||||
case HELIPORT_CODE:
|
||||
airport = new Airport( code, line );
|
||||
icao = airport->GetIcao();
|
||||
{
|
||||
Airport ap( code, line );
|
||||
icao = ap.GetIcao();
|
||||
match = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -592,7 +593,7 @@ int Parser::ParseLine(char* line)
|
|||
|
||||
if ( prev_node && (cur_node != prev_node) )
|
||||
{
|
||||
// prev node is done - process it\n");
|
||||
// prev node is done - process it
|
||||
if ( cur_state == STATE_PARSE_PAVEMENT )
|
||||
{
|
||||
cur_pavement->AddNode( prev_node );
|
||||
|
|
|
@ -179,7 +179,6 @@ bool Scheduler::IsAirportDefinition( char* line, std::string icao )
|
|||
{
|
||||
char* tok;
|
||||
int code;
|
||||
Airport* airport = NULL;
|
||||
bool match = false;
|
||||
|
||||
// Get the number code
|
||||
|
@ -195,11 +194,13 @@ bool Scheduler::IsAirportDefinition( char* line, std::string icao )
|
|||
case LAND_AIRPORT_CODE:
|
||||
case SEA_AIRPORT_CODE:
|
||||
case HELIPORT_CODE:
|
||||
airport = new Airport( code, line );
|
||||
if ( airport->GetIcao() == icao )
|
||||
{
|
||||
Airport ap( code, line );
|
||||
if ( ap.GetIcao() == icao )
|
||||
{
|
||||
match = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LAND_RUNWAY_CODE:
|
||||
|
@ -510,5 +511,6 @@ void Scheduler::Schedule( int num_threads, std::string& summaryfile )
|
|||
// Then wait until they are finished
|
||||
for (unsigned int i=0; i<parsers.size(); i++) {
|
||||
parsers[i]->join();
|
||||
delete parsers[i];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue