diff options
-rw-r--r-- | test/core/util/passthru_endpoint.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c index 168ae59e91..ae955b1f68 100644 --- a/test/core/util/passthru_endpoint.c +++ b/test/core/util/passthru_endpoint.c @@ -83,11 +83,15 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, if (m->parent->shutdown) { ok = false; } else if (m->on_read != NULL) { - gpr_slice_buffer_addn(m->on_read_out, slices->slices, slices->count); + for (size_t i = 0; i < slices->count; i++) { + gpr_slice_buffer_add(m->on_read_out, gpr_slice_ref(slices->slices[i])); + } grpc_exec_ctx_enqueue(exec_ctx, m->on_read, true, NULL); m->on_read = NULL; } else { - gpr_slice_buffer_addn(&m->read_buffer, slices->slices, slices->count); + for (size_t i = 0; i < slices->count; i++) { + gpr_slice_buffer_add(&m->read_buffer, gpr_slice_ref(slices->slices[i])); + } } gpr_mu_unlock(&m->parent->mu); grpc_exec_ctx_enqueue(exec_ctx, cb, ok, NULL); |