diff options
author | 2016-04-05 20:17:38 -0700 | |
---|---|---|
committer | 2016-04-05 20:17:38 -0700 | |
commit | 16c13451f0f686faadda0e13bf3d5ee7f076430b (patch) | |
tree | 78d1e4bd1bf60192c5db5736b085ee0ff4bfe1b9 /src/core/ext/client_config | |
parent | 0b541630192d676169b785488fc08c0e863fff62 (diff) |
Fix init ordering,memory leaks
Diffstat (limited to 'src/core/ext/client_config')
-rw-r--r-- | src/core/ext/client_config/client_config_plugin.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/ext/client_config/client_config_plugin.c b/src/core/ext/client_config/client_config_plugin.c index aac57b5e6a..6cd8a2ffd2 100644 --- a/src/core/ext/client_config/client_config_plugin.c +++ b/src/core/ext/client_config/client_config_plugin.c @@ -35,6 +35,8 @@ #include <stdbool.h> #include <string.h> +#include <grpc/support/alloc.h> + #include "src/core/ext/client_config/client_channel.h" #include "src/core/ext/client_config/lb_policy_registry.h" #include "src/core/ext/client_config/resolver_registry.h" @@ -64,8 +66,10 @@ static bool set_default_host_if_unset(grpc_channel_stack_builder *builder, arg.key = GRPC_ARG_DEFAULT_AUTHORITY; arg.value.string = grpc_get_default_authority( grpc_channel_stack_builder_get_target(builder)); - grpc_channel_stack_builder_set_channel_arguments( - builder, grpc_channel_args_copy_and_add(args, &arg, 1)); + 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); return true; } |