Resolve review comments

pull/19139/head
yang-g 6 years ago
parent bd97b1361d
commit a874fd8bbb
  1. 7
      src/core/lib/security/transport/client_auth_filter.cc
  2. 2
      src/cpp/client/secure_credentials.cc

@ -121,11 +121,10 @@ void grpc_auth_metadata_context_copy(grpc_auth_metadata_context* from,
->Ref(DEBUG_LOCATION, "grpc_auth_metadata_context_copy") ->Ref(DEBUG_LOCATION, "grpc_auth_metadata_context_copy")
.release(); .release();
} }
to->service_url = to->service_url = gpr_strdup(from->service_url);
(from->service_url == nullptr) ? nullptr : strdup(from->service_url); to->method_name = gpr_strdup(from->method_name);
to->method_name =
(from->method_name == nullptr) ? nullptr : strdup(from->method_name);
} }
void grpc_auth_metadata_context_reset( void grpc_auth_metadata_context_reset(
grpc_auth_metadata_context* auth_md_context) { grpc_auth_metadata_context* auth_md_context) {
if (auth_md_context->service_url != nullptr) { if (auth_md_context->service_url != nullptr) {

@ -259,6 +259,8 @@ int MetadataCredentialsPluginWrapper::GetMetadata(
return true; return true;
} }
if (w->plugin_->IsBlocking()) { if (w->plugin_->IsBlocking()) {
// The internals of context may be destroyed if GetMetadata is cancelled.
// Make a copy for InvokePlugin.
grpc_auth_metadata_context context_copy = grpc_auth_metadata_context(); grpc_auth_metadata_context context_copy = grpc_auth_metadata_context();
grpc_auth_metadata_context_copy(&context, &context_copy); grpc_auth_metadata_context_copy(&context, &context_copy);
// Asynchronous return. // Asynchronous return.

Loading…
Cancel
Save