diff options
-rw-r--r-- | src/core/ext/client_config/subchannel_call_holder.c | 2 | ||||
-rw-r--r-- | src/core/lib/channel/channel_stack.c | 9 | ||||
-rw-r--r-- | src/core/lib/channel/connected_channel.c | 2 | ||||
-rw-r--r-- | src/core/lib/surface/call.c | 2 | ||||
-rw-r--r-- | test/core/end2end/tests/filter_call_init_fails.c | 6 |
5 files changed, 14 insertions, 7 deletions
diff --git a/src/core/ext/client_config/subchannel_call_holder.c b/src/core/ext/client_config/subchannel_call_holder.c index ac286825f6..be6d054af4 100644 --- a/src/core/ext/client_config/subchannel_call_holder.c +++ b/src/core/ext/client_config/subchannel_call_holder.c @@ -170,7 +170,7 @@ retry: &subchannel_call); if (error != GRPC_ERROR_NONE) { subchannel_call = CANCELLED_CALL; - fail_locked(exec_ctx, holder, error); + fail_locked(exec_ctx, holder, GRPC_ERROR_REF(error)); grpc_transport_stream_op_finish_with_failure(exec_ctx, op, error); } gpr_atm_rel_store(&holder->subchannel_call, diff --git a/src/core/lib/channel/channel_stack.c b/src/core/lib/channel/channel_stack.c index 70062e0c3b..7fcc0ef97f 100644 --- a/src/core/lib/channel/channel_stack.c +++ b/src/core/lib/channel/channel_stack.c @@ -189,8 +189,13 @@ grpc_error *grpc_call_stack_init(grpc_exec_ctx *exec_ctx, call_elems[i].call_data = user_data; grpc_error *error = call_elems[i].filter->init_call_elem(exec_ctx, &call_elems[i], &args); - if (error != GRPC_ERROR_NONE && first_error == GRPC_ERROR_NONE) - first_error = error; + if (error != GRPC_ERROR_NONE) { + if (first_error == GRPC_ERROR_NONE) { + first_error = error; + } else { + GRPC_ERROR_UNREF(error); + } + } user_data += ROUND_UP_TO_ALIGNMENT_SIZE(call_elems[i].filter->sizeof_call_data); } diff --git a/src/core/lib/channel/connected_channel.c b/src/core/lib/channel/connected_channel.c index ecafcc99c7..bad1c50a71 100644 --- a/src/core/lib/channel/connected_channel.c +++ b/src/core/lib/channel/connected_channel.c @@ -90,7 +90,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), &args->call_stack->refcount, args->server_transport_data); return r == 0 ? GRPC_ERROR_NONE - : GRPC_ERROR_CREATE("transport initialization failed"); + : GRPC_ERROR_CREATE("transport stream initialization failed"); } static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 345698092a..b3bf1427a3 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -274,7 +274,7 @@ grpc_call *grpc_call_create( grpc_error_get_str(error, GRPC_ERROR_STR_DESCRIPTION); close_with_status(&exec_ctx, call, (grpc_status_code)status, error_str == NULL ? "unknown error" : error_str); - grpc_error_unref(error); + GRPC_ERROR_UNREF(error); } if (cq != NULL) { GPR_ASSERT( diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index 4980b37278..08c377a281 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -246,8 +246,10 @@ static bool maybe_add_filter(grpc_channel_stack_builder *builder, void *arg) { grpc_channel_stack_builder_iterator *it = grpc_channel_stack_builder_create_iterator_at_last(builder); GPR_ASSERT(grpc_channel_stack_builder_move_prev(it)); - return grpc_channel_stack_builder_add_filter_before(it, &test_filter, NULL, - NULL); + const bool retval = grpc_channel_stack_builder_add_filter_before( + it, &test_filter, NULL, NULL); + grpc_channel_stack_builder_iterator_destroy(it); + return retval; } else { return true; } |