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");
|
TG_LOG(SG_GENERAL, SG_INFO, "Genapts finished successfully");
|
||||||
exit(0);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ bool Parser::GetAirportDefinition( char* line, std::string& icao )
|
||||||
{
|
{
|
||||||
char* tok;
|
char* tok;
|
||||||
int code;
|
int code;
|
||||||
Airport* airport = NULL;
|
|
||||||
bool match = false;
|
bool match = false;
|
||||||
|
|
||||||
// Get the number code
|
// Get the number code
|
||||||
|
@ -26,9 +25,11 @@ bool Parser::GetAirportDefinition( char* line, std::string& icao )
|
||||||
case LAND_AIRPORT_CODE:
|
case LAND_AIRPORT_CODE:
|
||||||
case SEA_AIRPORT_CODE:
|
case SEA_AIRPORT_CODE:
|
||||||
case HELIPORT_CODE:
|
case HELIPORT_CODE:
|
||||||
airport = new Airport( code, line );
|
{
|
||||||
icao = airport->GetIcao();
|
Airport ap( code, line );
|
||||||
|
icao = ap.GetIcao();
|
||||||
match = true;
|
match = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -592,7 +593,7 @@ int Parser::ParseLine(char* line)
|
||||||
|
|
||||||
if ( prev_node && (cur_node != prev_node) )
|
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 )
|
if ( cur_state == STATE_PARSE_PAVEMENT )
|
||||||
{
|
{
|
||||||
cur_pavement->AddNode( prev_node );
|
cur_pavement->AddNode( prev_node );
|
||||||
|
|
|
@ -179,7 +179,6 @@ bool Scheduler::IsAirportDefinition( char* line, std::string icao )
|
||||||
{
|
{
|
||||||
char* tok;
|
char* tok;
|
||||||
int code;
|
int code;
|
||||||
Airport* airport = NULL;
|
|
||||||
bool match = false;
|
bool match = false;
|
||||||
|
|
||||||
// Get the number code
|
// Get the number code
|
||||||
|
@ -195,11 +194,13 @@ bool Scheduler::IsAirportDefinition( char* line, std::string icao )
|
||||||
case LAND_AIRPORT_CODE:
|
case LAND_AIRPORT_CODE:
|
||||||
case SEA_AIRPORT_CODE:
|
case SEA_AIRPORT_CODE:
|
||||||
case HELIPORT_CODE:
|
case HELIPORT_CODE:
|
||||||
airport = new Airport( code, line );
|
{
|
||||||
if ( airport->GetIcao() == icao )
|
Airport ap( code, line );
|
||||||
|
if ( ap.GetIcao() == icao )
|
||||||
{
|
{
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAND_RUNWAY_CODE:
|
case LAND_RUNWAY_CODE:
|
||||||
|
@ -510,5 +511,6 @@ void Scheduler::Schedule( int num_threads, std::string& summaryfile )
|
||||||
// Then wait until they are finished
|
// Then wait until they are finished
|
||||||
for (unsigned int i=0; i<parsers.size(); i++) {
|
for (unsigned int i=0; i<parsers.size(); i++) {
|
||||||
parsers[i]->join();
|
parsers[i]->join();
|
||||||
|
delete parsers[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue