Currently the iterator isn't advanced after the erase call leading to a
second call on the iterator, which crashes due to a double free.
Since C++11 the map::erase function returns an iterator pointing to the
next element. Use the return value to set the iterator after erasing.
Fixes: http://tracker.ceph.com/issues/21808
Signed-off-by: Peter Keresztes Schmidt <carbenium@outlook.com>
(cherry picked from commit
9e49c4124422e58dd40dfb6038425430d3845412)
// default and omit it even if it was specified by the user
// (see ceph.git commit fb0f1986449b)
if (it->first == "rw" && it->second == "rw") {
- map_options.erase(it);
+ it = map_options.erase(it);
} else {
if (it != map_options.begin())
oss << ",";