From 2f4679ea348637cd5882ace228f2dc6bc0649d4c Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 14 Apr 2017 13:06:27 -0700 Subject: Fix handling of slice in http_client_filter --- src/core/ext/filters/http/client/http_client_filter.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/core/ext/filters/http/client/http_client_filter.c') diff --git a/src/core/ext/filters/http/client/http_client_filter.c b/src/core/ext/filters/http/client/http_client_filter.c index b896c7e7bb..7bab7b1462 100644 --- a/src/core/ext/filters/http/client/http_client_filter.c +++ b/src/core/ext/filters/http/client/http_client_filter.c @@ -313,7 +313,6 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx, estimated_len += grpc_base64_estimate_encoded_size( op->payload->send_message.send_message->length, k_url_safe, k_multi_line); - estimated_len += 1; /* for the trailing 0 */ grpc_slice path_with_query_slice = grpc_slice_malloc(estimated_len); /* memcopy individual pieces into this slice */ @@ -335,7 +334,7 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx, char *t = (char *)GRPC_SLICE_START_PTR(path_with_query_slice); /* safe to use strlen since base64_encode will always add '\0' */ path_with_query_slice = - grpc_slice_sub(path_with_query_slice, 0, strlen(t)); + grpc_slice_sub_no_ref(path_with_query_slice, 0, strlen(t)); /* substitute previous path with the new path+query */ grpc_mdelem mdelem_path_and_query = grpc_mdelem_from_slices( @@ -349,7 +348,6 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx, calld->on_complete = op->on_complete; op->on_complete = &calld->hc_on_complete; op->send_message = false; - grpc_slice_unref_internal(exec_ctx, path_with_query_slice); } else { /* Not all data is available. Fall back to POST. */ gpr_log(GPR_DEBUG, -- cgit v1.2.3