aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2018-03-27 14:21:06 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2018-03-27 14:21:06 -0700
commit46511cd5d3488007b22480d64074feff0bf71010 (patch)
treeaa27c88fc351f947e95d4c5dd39dd459f1b9a7f9
parentd5d36d7b7bdcb0f8dcba780deec1ec7b567c158d (diff)
malloc to stack
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
index 76c1225c48..e6c8c38260 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
@@ -41,16 +41,13 @@ static void client_channel_factory_unref(
static grpc_subchannel* client_channel_factory_create_subchannel(
grpc_client_channel_factory* cc_factory, const grpc_subchannel_args* args) {
- grpc_subchannel_args* final_sc_args =
- static_cast<grpc_subchannel_args*>(gpr_malloc(sizeof(*final_sc_args)));
- memcpy(final_sc_args, args, sizeof(*args));
- final_sc_args->args = grpc_default_authority_add_if_not_present(args->args);
+ grpc_subchannel_args final_sc_args;
+ memcpy(&final_sc_args, args, sizeof(*args));
+ final_sc_args.args = grpc_default_authority_add_if_not_present(args->args);
grpc_connector* connector = grpc_chttp2_connector_create();
- grpc_subchannel* s = grpc_subchannel_create(connector, final_sc_args);
+ grpc_subchannel* s = grpc_subchannel_create(connector, &final_sc_args);
grpc_connector_unref(connector);
- grpc_channel_args_destroy(
- const_cast<grpc_channel_args*>(final_sc_args->args));
- gpr_free(final_sc_args);
+ grpc_channel_args_destroy(const_cast<grpc_channel_args*>(final_sc_args.args));
return s;
}