diff --git a/src/core/net/srp_server.cpp b/src/core/net/srp_server.cpp index aa8efb80a..a69790625 100644 --- a/src/core/net/srp_server.cpp +++ b/src/core/net/srp_server.cpp @@ -629,8 +629,11 @@ void Server::CommitSrpUpdate(Error aError, if (grantedKeyLease == 0) { - VerifyOrExit(existingHost != nullptr); - LogInfo("Fully remove host %s", aHost.GetFullName()); + if (existingHost != nullptr) + { + LogInfo("Fully remove host %s", aHost.GetFullName()); + } + aHost.Free(); ExitNow(); }