diff options
author | Mark D. Roth <roth@google.com> | 2016-06-29 14:38:37 -0700 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2016-06-29 14:38:37 -0700 |
commit | afa864244d921626480abc6e4408a2aa183396c3 (patch) | |
tree | ea1af25fe23c15a394c51ce54d51ced7d4afe1ea | |
parent | acfb34333d09b2182c79ff2df7f5e0a6102c7b80 (diff) |
When call creation fails, free the allocated call.
-rw-r--r-- | src/core/ext/client_config/subchannel.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/ext/client_config/subchannel.c b/src/core/ext/client_config/subchannel.c index 8a1ac68c6e..495ca46cc8 100644 --- a/src/core/ext/client_config/subchannel.c +++ b/src/core/ext/client_config/subchannel.c @@ -706,8 +706,7 @@ grpc_error *grpc_connected_subchannel_create_call( grpc_channel_stack *chanstk = CHANNEL_STACK_FROM_CONNECTION(con); *call = gpr_malloc(sizeof(grpc_subchannel_call) + chanstk->call_stack_size); grpc_call_stack *callstk = SUBCHANNEL_CALL_TO_CALL_STACK(*call); - (*call)->connection = con; - GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call"); + (*call)->connection = con; // Ref is added below. grpc_error *error = grpc_call_stack_init(exec_ctx, chanstk, 1, subchannel_call_destroy, *call, NULL, NULL, callstk); @@ -715,8 +714,10 @@ grpc_error *grpc_connected_subchannel_create_call( const char *error_string = grpc_error_string(error); gpr_log(GPR_ERROR, "error: %s", error_string); grpc_error_free_string(error_string); + gpr_free(*call); return error; } + GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call"); grpc_call_stack_set_pollset_or_pollset_set(exec_ctx, callstk, pollent); return GRPC_ERROR_NONE; } |