diff --git a/orchagent/vnetorch.cpp b/orchagent/vnetorch.cpp index d8b11fe0a4..6fb9de0ad1 100644 --- a/orchagent/vnetorch.cpp +++ b/orchagent/vnetorch.cpp @@ -1545,7 +1545,8 @@ void VNetRouteOrch::delEndpointMonitor(const string& vnet, NextHopGroupKey& next if (nexthop_info_[vnet].find(ip) != nexthop_info_[vnet].end()) { if (--nexthop_info_[vnet][ip].ref_count == 0) { - removeBfdSession(vnet, nhk, nexthop_info_[vnet][ip].monitor_addr); + IpAddress monitor_addr = nexthop_info_[vnet][ip].monitor_addr; + removeBfdSession(vnet, nhk, monitor_addr); } } } diff --git a/orchagent/vxlanorch.cpp b/orchagent/vxlanorch.cpp index 982a2f1a45..31dbf34514 100644 --- a/orchagent/vxlanorch.cpp +++ b/orchagent/vxlanorch.cpp @@ -1110,13 +1110,14 @@ void VxlanTunnel::updateRemoteEndPointIpRef(const std::string remote_vtep, bool it->second.ip_refcnt++; } SWSS_LOG_DEBUG("Incrementing remote end point %s reference to %d", remote_vtep.c_str(), - it->second.ip_refcnt); + tnl_users_[remote_vtep].ip_refcnt); } else { if (it == tnl_users_.end()) { SWSS_LOG_ERROR("Cannot decrement ref. End point not referenced %s", remote_vtep.c_str()); + return; } it->second.ip_refcnt--;