diff --git a/src/vnm/AddressRange.cc b/src/vnm/AddressRange.cc index efe1839d8b..b8e2abb463 100644 --- a/src/vnm/AddressRange.cc +++ b/src/vnm/AddressRange.cc @@ -446,7 +446,18 @@ int AddressRange::update_attributes( return -1; } - if (allocated.upper_bound(new_size-1) != allocated.end()) + std::map::iterator it; + + if ( new_size == 0 ) + { + it = allocated.find(0); + } + else + { + it = allocated.upper_bound(new_size - 1); + } + + if (it != allocated.end()) { error_msg = "New SIZE cannot be applied. There are used leases" " that would fall outside the range.";