aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-04-29 12:48:25 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-04-29 12:48:25 -0700
commit91cda8ff10038754266b975d2c9e8bcd36f63f82 (patch)
tree9569dcd2fc8f775ef788dba545ac1207a3905a70
parent712cb7892fb4f1d5568054effc92846a2499e66e (diff)
parent904e0a50866f6700dba74f31e1734be448d481f1 (diff)
Merge pull request #6354 from ctiller/portabit
Fix double delete
-rw-r--r--test/core/util/passthru_endpoint.c8
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);