From: ehofman Date: Sun, 11 Dec 2005 13:17:20 +0000 (+0000) Subject: The most important part is that it fixes possible X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=04f7175fd03df1abfd4f9385c0f35c53929c0e80;p=flightgear.git The most important part is that it fixes possible memory corruption with that iterator decrement past the erase call. --- diff --git a/src/ATC/tower.cxx b/src/ATC/tower.cxx index 59de9b939..25801f5d6 100644 --- a/src/ATC/tower.cxx +++ b/src/ATC/tower.cxx @@ -2151,14 +2151,15 @@ void FGTower::RemovePlane(const string& ID) { t = *twrItr; twrItr = appList.erase(twrItr); appListItr = appList.begin(); + break; } } for(twrItr = depList.begin(); twrItr != depList.end(); twrItr++) { if((*twrItr)->plane.callsign == ID) { t = *twrItr; twrItr = depList.erase(twrItr); - twrItr--; depListItr = depList.begin(); + break; } } for(twrItr = circuitList.begin(); twrItr != circuitList.end(); twrItr++) { @@ -2166,6 +2167,7 @@ void FGTower::RemovePlane(const string& ID) { t = *twrItr; twrItr = circuitList.erase(twrItr); circuitListItr = circuitList.begin(); + break; } } for(twrItr = holdList.begin(); twrItr != holdList.end(); twrItr++) { @@ -2173,6 +2175,7 @@ void FGTower::RemovePlane(const string& ID) { t = *twrItr; twrItr = holdList.erase(twrItr); holdListItr = holdList.begin(); + break; } } for(twrItr = rwyList.begin(); twrItr != rwyList.end(); twrItr++) { @@ -2180,6 +2183,7 @@ void FGTower::RemovePlane(const string& ID) { t = *twrItr; twrItr = rwyList.erase(twrItr); rwyListItr = rwyList.begin(); + break; } } for(twrItr = vacatedList.begin(); twrItr != vacatedList.end(); twrItr++) { @@ -2187,6 +2191,7 @@ void FGTower::RemovePlane(const string& ID) { t = *twrItr; twrItr = vacatedList.erase(twrItr); vacatedListItr = vacatedList.begin(); + break; } } for(twrItr = trafficList.begin(); twrItr != trafficList.end(); twrItr++) { @@ -2194,6 +2199,7 @@ void FGTower::RemovePlane(const string& ID) { t = *twrItr; twrItr = trafficList.erase(twrItr); trafficListItr = trafficList.begin(); + break; } } // And finally, delete the record.