Make sure the iterator isn't incremented twice if a element gets erased.
Move increment out of the for-loop header and add it to a new else block.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
void AuthMethodList::remove_supported_auth(int auth_type)
{
- for (list<__u32>::iterator p = auth_supported.begin(); p != auth_supported.end(); ++p) {
+ for (list<__u32>::iterator p = auth_supported.begin(); p != auth_supported.end(); ) {
if (*p == (__u32)auth_type)
auth_supported.erase(p++);
+ else
+ ++p;
}
}