Skip to content

Commit

Permalink
[srp-server] avoid re-accessing committed SRP updates (openthread#6785)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wgtdkp authored Jul 6, 2021
1 parent 49817fc commit 38cb99f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/core/net/srp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 38cb99f

Please sign in to comment.