diff options
-rw-r--r-- | src/core/ext/client_config/client_channel.c | 1 | ||||
-rw-r--r-- | src/core/ext/client_config/lb_policy_factory.c | 16 | ||||
-rw-r--r-- | src/core/ext/client_config/lb_policy_factory.h | 1 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/core/ext/client_config/client_channel.c b/src/core/ext/client_config/client_channel.c index 946fff9cf2..63797bfa1e 100644 --- a/src/core/ext/client_config/client_channel.c +++ b/src/core/ext/client_config/client_channel.c @@ -784,6 +784,7 @@ void grpc_client_channel_finish_initialization( grpc_resolver *resolver, grpc_client_channel_factory *client_channel_factory) { /* post construction initialization: set the transport setup pointer */ + GPR_ASSERT(client_channel_factory != NULL); grpc_channel_element *elem = grpc_channel_stack_last_element(channel_stack); channel_data *chand = elem->channel_data; gpr_mu_lock(&chand->mu); diff --git a/src/core/ext/client_config/lb_policy_factory.c b/src/core/ext/client_config/lb_policy_factory.c index 8ce8745504..c17af91a09 100644 --- a/src/core/ext/client_config/lb_policy_factory.c +++ b/src/core/ext/client_config/lb_policy_factory.c @@ -49,19 +49,21 @@ grpc_lb_addresses* grpc_lb_addresses_create(size_t num_addresses) { grpc_lb_addresses* grpc_lb_addresses_copy(grpc_lb_addresses* addresses, void* (*user_data_copy)(void*)) { - grpc_lb_addresses* new = grpc_lb_addresses_create(addresses->num_addresses); - memcpy(new->addresses, addresses->addresses, + grpc_lb_addresses* new_addresses = + grpc_lb_addresses_create(addresses->num_addresses); + memcpy(new_addresses->addresses, addresses->addresses, sizeof(grpc_lb_address) * addresses->num_addresses); for (size_t i = 0; i < addresses->num_addresses; ++i) { - if (new->addresses[i].balancer_name != NULL) { - new->addresses[i].balancer_name = - gpr_strdup(new->addresses[i].balancer_name); + if (new_addresses->addresses[i].balancer_name != NULL) { + new_addresses->addresses[i].balancer_name = + gpr_strdup(new_addresses->addresses[i].balancer_name); } if (user_data_copy != NULL) { - new->addresses[i].user_data = user_data_copy(new->addresses[i].user_data); + new_addresses->addresses[i].user_data = + user_data_copy(new_addresses->addresses[i].user_data); } } - return new; + return new_addresses; } void grpc_lb_addresses_set_address(grpc_lb_addresses* addresses, size_t index, diff --git a/src/core/ext/client_config/lb_policy_factory.h b/src/core/ext/client_config/lb_policy_factory.h index c9499d4f87..54408c6308 100644 --- a/src/core/ext/client_config/lb_policy_factory.h +++ b/src/core/ext/client_config/lb_policy_factory.h @@ -92,6 +92,7 @@ void grpc_lb_addresses_destroy(grpc_lb_addresses *addresses, typedef struct grpc_lb_policy_args { grpc_lb_addresses *addresses; grpc_client_channel_factory *client_channel_factory; + /* Can be used to pass implementation-specific parameters to the LB policy. */ grpc_channel_args *additional_args; } grpc_lb_policy_args; |