Skip to content

Commit

Permalink
Fix reference to out-of-scope temporary in SetUpCodePairer. (#24316)
Browse files Browse the repository at this point in the history
The old code used to get a reference to a member of a temporary, but nothing
kept the temporary alive (it was not assigned to a named reference or anything),
so it went out of scope and got destroyed.  And then we were referencing
garbage.

Explicitly keep references to all the things we are using, so they don't go away
on us.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Feb 15, 2024
1 parent 3b7b9a7 commit 1266419
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/controller/SetUpCodePairer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,8 @@ void SetUpCodePairer::OnPairingComplete(CHIP_ERROR error)
if (CHIP_ERROR_TIMEOUT == error && mCurrentPASEParameters.HasValue())
{
const auto & params = mCurrentPASEParameters.Value();
auto & ip = params.GetPeerAddress().GetIPAddress();
const auto & peer = params.GetPeerAddress();
const auto & ip = peer.GetIPAddress();
auto err = Dnssd::Resolver::Instance().ReconfirmRecord(params.mHostName, ip, params.mInterfaceId);
if (CHIP_NO_ERROR != err && CHIP_ERROR_NOT_IMPLEMENTED != err)
{
Expand Down

0 comments on commit 1266419

Please sign in to comment.