From d0b3ae40f70d89a74a70cc6fc2fb0935bef7a99b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 28 Apr 2016 16:20:03 -0700 Subject: Fix double delete --- test/core/util/passthru_endpoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c index 168ae59e91..159155886d 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->read_buffer, 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); -- cgit v1.2.3 From 904e0a50866f6700dba74f31e1734be448d481f1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 28 Apr 2016 16:38:01 -0700 Subject: Fix typo --- test/core/util/passthru_endpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c index 159155886d..ae955b1f68 100644 --- a/test/core/util/passthru_endpoint.c +++ b/test/core/util/passthru_endpoint.c @@ -84,7 +84,7 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, ok = false; } else if (m->on_read != NULL) { for (size_t i = 0; i < slices->count; i++) { - gpr_slice_buffer_add(&m->read_buffer, gpr_slice_ref(slices->slices[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; -- cgit v1.2.3