Delete correct rpt

iterator is changed by erase vector function thus we were deleting incorrect rpt from vector and leaving memory unstable...
This commit is contained in:
Miguel Estrada 2021-08-22 23:52:37 -04:00 committed by GitHub
parent 55cefd6e64
commit 4374454783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -233,8 +233,8 @@ void CP25Reflector::run()
for (std::vector<CP25Repeater*>::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) {
if (CUDPSocket::match((*it)->m_addr, rpt->m_addr)) {
m_repeaters.erase(it);
delete *it;
m_repeaters.erase(it);
break;
}
}
@ -304,8 +304,8 @@ void CP25Reflector::run()
LogMessage("Removing %s (%s) disappeared", (*it)->m_callsign.c_str(),
CUDPSocket::display((*it)->m_addr, buff, 80U));
m_repeaters.erase(it);
delete *it;
m_repeaters.erase(it);
break;
}
}