Fix init ordering,memory leaks

pull/6092/head
Craig Tiller 9 years ago
parent 0b54163019
commit 16c13451f0
  1. 8
      src/core/ext/client_config/client_config_plugin.c
  2. 2
      src/core/lib/channel/channel_stack_builder.c
  3. 2
      src/core/lib/surface/init.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;
}

@ -142,7 +142,7 @@ void grpc_channel_stack_builder_set_channel_arguments(
if (builder->args != NULL) {
grpc_channel_args_destroy(builder->args);
}
builder->args = grpc_channel_args_copy(builder->args);
builder->args = grpc_channel_args_copy(args);
}
void grpc_channel_stack_builder_set_transport(

@ -126,7 +126,7 @@ static void register_builtin_channel_init() {
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
append_filter, (void *)&grpc_lame_filter);
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter,
GRPC_SERVER_CHANNEL, INT_MAX, prepend_filter,
(void *)&grpc_server_top_filter);
}

Loading…
Cancel
Save