Skip to content

Commit

Permalink
Fixed asan failure and some refcounting bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
markdroth committed Jul 27, 2016
1 parent 898d84d commit 05d73af
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/core/ext/client_config/subchannel_call_holder.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void grpc_subchannel_call_holder_perform_op(grpc_exec_ctx *exec_ctx,
&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,
Expand Down
9 changes: 7 additions & 2 deletions src/core/lib/channel/channel_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/channel/connected_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/surface/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions test/core/end2end/tests/filter_call_init_fails.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion third_party/protobuf

0 comments on commit 05d73af

Please sign in to comment.