aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-04-06 09:52:56 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-04-06 09:52:56 -0700
commit96acdee66c6f03b7514fb7430911c42d07845c61 (patch)
treeb480b7af6f30b2a0aaa1ea9ec12a0e687e93ec33 /src
parent9d7f22477aff1271eff99647e3c03a6ee30251e5 (diff)
Deal with no default authority being available
Diffstat (limited to 'src')
-rw-r--r--src/core/ext/client_config/client_config_plugin.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/core/ext/client_config/client_config_plugin.c b/src/core/ext/client_config/client_config_plugin.c
index 6cd8a2ffd2..08f0790234 100644
--- a/src/core/ext/client_config/client_config_plugin.c
+++ b/src/core/ext/client_config/client_config_plugin.c
@@ -61,15 +61,18 @@ static bool set_default_host_if_unset(grpc_channel_stack_builder *builder,
return true;
}
}
- grpc_arg arg;
- arg.type = GRPC_ARG_STRING;
- arg.key = GRPC_ARG_DEFAULT_AUTHORITY;
- arg.value.string = grpc_get_default_authority(
+ char *default_authority = grpc_get_default_authority(
grpc_channel_stack_builder_get_target(builder));
- grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
- grpc_channel_stack_builder_set_channel_arguments(builder, new_args);
- gpr_free(arg.value.string);
- grpc_channel_args_destroy(new_args);
+ if (default_authority != NULL) {
+ grpc_arg arg;
+ arg.type = GRPC_ARG_STRING;
+ arg.key = GRPC_ARG_DEFAULT_AUTHORITY;
+ arg.value.string = default_authority;
+ grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
+ grpc_channel_stack_builder_set_channel_arguments(builder, new_args);
+ gpr_free(default_authority);
+ grpc_channel_args_destroy(new_args);
+ }
return true;
}