Fixes access ponter after free in connection_info.channel->GetMedium()

PiperOrigin-RevId: 393904932
This commit is contained in:
edwinwu
2021-08-30 19:40:21 -07:00
committed by Copybara-Service
parent ebec902cb8
commit f37dfd2e8a
2 changed files with 6 additions and 7 deletions
+5 -6
View File
@@ -334,12 +334,13 @@ void BasePcpHandler::OnEncryptionSuccessRunnable(
}
BasePcpHandler::PendingConnectionInfo& connection_info = it->second;
Medium medium = connection_info.channel->GetMedium();
if (!ukey2) {
// Fail early, if there is no crypto context.
ProcessPreConnectionInitiationFailure(
connection_info.client, connection_info.channel->GetMedium(),
endpoint_id, connection_info.channel.get(), connection_info.is_incoming,
connection_info.client, medium, endpoint_id,
connection_info.channel.get(), connection_info.is_incoming,
connection_info.start_time, {Status::kEndpointIoError},
connection_info.result.lock().get());
return;
@@ -392,14 +393,12 @@ void BasePcpHandler::OnEncryptionSuccessRunnable(
if (connection_info.is_incoming) {
connection_info.client->GetAnalyticsRecorder().OnIncomingConnectionAttempt(
proto::connections::INITIAL, connection_info.channel->GetMedium(),
proto::connections::RESULT_SUCCESS,
proto::connections::INITIAL, medium, proto::connections::RESULT_SUCCESS,
SystemClock::ElapsedRealtime() - connection_info.start_time,
connection_info.connection_token);
} else {
connection_info.client->GetAnalyticsRecorder().OnOutgoingConnectionAttempt(
endpoint_id, proto::connections::INITIAL,
connection_info.channel->GetMedium(),
endpoint_id, proto::connections::INITIAL, medium,
proto::connections::RESULT_SUCCESS,
SystemClock::ElapsedRealtime() - connection_info.start_time,
connection_info.connection_token);