diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-03-18 14:08:22 +0100 |
---|---|---|
committer | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-03-18 14:08:22 +0100 |
commit | c091dcc0d795b12cdca6a040051cb3f7dfbd6981 (patch) | |
tree | 2810ae3c4fee33e2cdbd8beb3a79e881e1813f02 | |
parent | a96a1cc5f1c2086b1a915e9b996f5cd1ab60d5a2 (diff) | |
download | ceph-c091dcc0d795b12cdca6a040051cb3f7dfbd6981.tar.gz |
auth/AuthMethodList.cc: fix remove_supported_auth()
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>
-rw-r--r-- | src/auth/AuthMethodList.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/auth/AuthMethodList.cc b/src/auth/AuthMethodList.cc index e345e150549..50d58bff4d4 100644 --- a/src/auth/AuthMethodList.cc +++ b/src/auth/AuthMethodList.cc @@ -59,8 +59,10 @@ int AuthMethodList::pick(const std::set<__u32>& supported) 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; } } |