diff --git a/src/core/channel/channel_stack.c b/src/core/channel/channel_stack.c index 1320568d23d..c70b565d2b9 100644 --- a/src/core/channel/channel_stack.c +++ b/src/core/channel/channel_stack.c @@ -209,7 +209,7 @@ void grpc_call_element_recv_metadata(grpc_call_element *cur_elem, metadata_op.dir = GRPC_CALL_UP; metadata_op.done_cb = do_nothing; metadata_op.user_data = NULL; - metadata_op.data.metadata = grpc_mdelem_ref(mdelem); + metadata_op.data.metadata = mdelem; grpc_call_next_op(cur_elem, &metadata_op); } @@ -220,7 +220,7 @@ void grpc_call_element_send_metadata(grpc_call_element *cur_elem, metadata_op.dir = GRPC_CALL_DOWN; metadata_op.done_cb = do_nothing; metadata_op.user_data = NULL; - metadata_op.data.metadata = grpc_mdelem_ref(mdelem); + metadata_op.data.metadata = mdelem; grpc_call_next_op(cur_elem, &metadata_op); } diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index b139b72795f..1f6f3e0ca3d 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -67,8 +67,8 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, /* Send : prefixed headers, which have to be before any application * layer headers. */ calld->sent_headers = 1; - grpc_call_element_send_metadata(elem, channeld->method); - grpc_call_element_send_metadata(elem, channeld->scheme); + grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->method)); + grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->scheme)); } grpc_call_next_op(elem, op); break; @@ -76,12 +76,12 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, if (!calld->sent_headers) { /* Send : prefixed headers, if we haven't already */ calld->sent_headers = 1; - grpc_call_element_send_metadata(elem, channeld->method); - grpc_call_element_send_metadata(elem, channeld->scheme); + grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->method)); + grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->scheme)); } /* Send non : prefixed headers */ - grpc_call_element_send_metadata(elem, channeld->te_trailers); - grpc_call_element_send_metadata(elem, channeld->content_type); + grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->te_trailers)); + grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->content_type)); grpc_call_next_op(elem, op); break; default: diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index 8290ead8a78..87f9f437e6b 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -127,7 +127,7 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, gpr_log(GPR_ERROR, "Received :path twice"); grpc_mdelem_unref(calld->path); } - calld->path = grpc_mdelem_ref(op->data.metadata); + calld->path = op->data.metadata; op->done_cb(op->user_data, GRPC_OP_OK); } else { /* pass the event up */ @@ -163,7 +163,7 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, if (!calld->sent_status) { calld->sent_status = 1; /* status is reffed by grpc_call_element_send_metadata */ - grpc_call_element_send_metadata(elem, channeld->status); + grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->status)); } grpc_call_next_op(elem, op); break; diff --git a/src/core/security/auth.c b/src/core/security/auth.c index f743b258382..9d0c075bc3f 100644 --- a/src/core/security/auth.c +++ b/src/core/security/auth.c @@ -57,7 +57,7 @@ static void on_credentials_metadata(void *user_data, grpc_mdelem **md_elems, grpc_call_element *elem = (grpc_call_element *)user_data; size_t i; for (i = 0; i < num_md; i++) { - grpc_call_element_send_metadata(elem, md_elems[i]); + grpc_call_element_send_metadata(elem, grpc_mdelem_ref(md_elems[i])); } grpc_call_next_op(elem, &((call_data *)elem->call_data)->op); }