[srp-server] avoid re-accessing committed SRP updates (#6785)

We should remove the UpdateMetadata before committing the SRP update
to ensure that the same UpdateMetadata (and the Host object) can never
be touched again.
This commit is contained in:
kangping
2021-07-06 11:41:08 -07:00
committed by GitHub
parent 49817fc417
commit 38cb99f0fc
+1 -2
View File
@@ -298,9 +298,8 @@ void Server::HandleServiceUpdateResult(ServiceUpdateId aId, Error aError)
void Server::HandleServiceUpdateResult(UpdateMetadata *aUpdate, Error aError)
{
CommitSrpUpdate(aError, aUpdate->GetDnsHeader(), aUpdate->GetHost(), aUpdate->GetMessageInfo());
IgnoreError(mOutstandingUpdates.Remove(*aUpdate));
CommitSrpUpdate(aError, aUpdate->GetDnsHeader(), aUpdate->GetHost(), aUpdate->GetMessageInfo());
aUpdate->Free();
if (mOutstandingUpdates.IsEmpty())