use insert(.) on unordered map instead of access operator, potential resource leak

This commit is contained in:
Dennis Luxen 2014-04-17 11:05:26 +02:00
parent b2b36984e1
commit 62ccbc7490

View File

@ -145,7 +145,7 @@ public:
if(restriction_iterator == m_restriction_map.end()) { if(restriction_iterator == m_restriction_map.end()) {
index = m_restriction_bucket_list.size(); index = m_restriction_bucket_list.size();
m_restriction_bucket_list.resize(index+1); m_restriction_bucket_list.resize(index+1);
m_restriction_map[restrictionSource] = index; m_restriction_map.insert(std::make_pair(restrictionSource, index));
} else { } else {
index = restriction_iterator->second; index = restriction_iterator->second;
//Map already contains an is_only_*-restriction //Map already contains an is_only_*-restriction
@ -358,6 +358,7 @@ public:
"identified: " << component_size_vector.size() << "identified: " << component_size_vector.size() <<
" many components, marking small components"; " many components, marking small components";
// TODO/C++11: prime candidate for lambda function
unsigned size_one_counter = 0; unsigned size_one_counter = 0;
for(unsigned i = 0, end = component_size_vector.size(); i < end; ++i){ for(unsigned i = 0, end = component_size_vector.size(); i < end; ++i){
if(1 == component_size_vector[i]) { if(1 == component_size_vector[i]) {