From fc39894541b4b88be346871e998d940ca2de634d Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 31 Jul 2020 13:53:11 -0700 Subject: [PATCH] Small fix to reduce memory use a little bit more. --- core/Locator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Locator.cpp b/core/Locator.cpp index 3b05ba504..994b107a4 100644 --- a/core/Locator.cpp +++ b/core/Locator.cpp @@ -35,12 +35,12 @@ bool Locator::add(const Endpoint &ep, const SharedPtr< const EndpointAttributes { for (Vector< std::pair< Endpoint, SharedPtr< const EndpointAttributes > > >::iterator i(m_endpoints.begin());i!=m_endpoints.end();++i) { if (i->first == ep) { - i->second = (a) ? a : EndpointAttributes::DEFAULT; + i->second = ((a) && (a->data[0] != 0)) ? a : EndpointAttributes::DEFAULT; return true; } } if (m_endpoints.size() < ZT_LOCATOR_MAX_ENDPOINTS) { - m_endpoints.push_back(std::pair >(ep, (a) ? a : EndpointAttributes::DEFAULT)); + m_endpoints.push_back(std::pair >(ep, ((a) && (a->data[0] != 0)) ? a : EndpointAttributes::DEFAULT)); return true; } return false;