Skip to content

Commit

Permalink
AddressSanitizer: heap-use-after-free in chip::Controller::DeviceComm…
Browse files Browse the repository at this point in the history
…issioner::CommissioningStageComplete (#17504)
  • Loading branch information
vivien-apple authored Apr 19, 2022
1 parent baf0b7b commit 03ea72d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1553,12 +1553,6 @@ void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, PeerId peer
ChipLogError(Controller, "Device connection failed without a valid error code. Making one up.");
error = CHIP_ERROR_INTERNAL;
}
// TODO: Determine if we really want the PASE session removed here. See #16089.
CommissioneeDeviceProxy * commissionee = commissioner->FindCommissioneeDevice(peerId.GetNodeId());
if (commissionee != nullptr)
{
commissioner->ReleaseCommissioneeDevice(commissionee);
}

commissioner->mSystemState->CASESessionMgr()->ReleaseSession(peerId);
if (commissioner->mCommissioningStage == CommissioningStage::kFindOperational &&
Expand All @@ -1570,6 +1564,13 @@ void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, PeerId peer
{
commissioner->mPairingDelegate->OnPairingComplete(error);
}

CommissioneeDeviceProxy * commissionee = commissioner->FindCommissioneeDevice(peerId.GetNodeId());
// TODO: Determine if we really want the PASE session removed here. See #16089.
if (commissionee != nullptr)
{
commissioner->ReleaseCommissioneeDevice(commissionee);
}
}

// ClusterStateCache::Callback impl
Expand Down

0 comments on commit 03ea72d

Please sign in to comment.