From bb76c33a0c2c3871b04f651c38108f4895f4a772 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 16 May 2016 18:41:45 -0700 Subject: [PATCH 1/2] Fixes leak in test_cancel_after_client_done & cancel_after_accept --- test/core/end2end/fixtures/proxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index f6e01ec41c5..196e481302b 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -253,7 +253,6 @@ static void on_c2p_sent_message(void *arg, int success) { grpc_op op; grpc_call_error err; - grpc_byte_buffer_destroy(pc->p2s_msg); if (!pc->proxy->shutdown && success) { op.op = GRPC_OP_RECV_MESSAGE; op.flags = 0; @@ -284,6 +283,7 @@ static void on_p2s_recv_msg(void *arg, int success) { GPR_ASSERT(err == GRPC_CALL_OK); } unrefpc(pc, "on_p2s_recv_msg"); + grpc_byte_buffer_destroy(pc->p2s_msg); } static void on_c2p_sent_status(void *arg, int success) { From 3c4fe1bcb746955428c8ad78b8875fd5de3733dd Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 20 May 2016 10:07:23 -0700 Subject: [PATCH 2/2] Fixed the fix --- test/core/end2end/fixtures/proxy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index 196e481302b..7f10649fa69 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -253,6 +253,7 @@ static void on_c2p_sent_message(void *arg, int success) { grpc_op op; grpc_call_error err; + grpc_byte_buffer_destroy(pc->p2s_msg); if (!pc->proxy->shutdown && success) { op.op = GRPC_OP_RECV_MESSAGE; op.flags = 0; @@ -281,9 +282,10 @@ static void on_p2s_recv_msg(void *arg, int success) { err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_sent_message, pc), NULL); GPR_ASSERT(err == GRPC_CALL_OK); + } else { + grpc_byte_buffer_destroy(pc->p2s_msg); } unrefpc(pc, "on_p2s_recv_msg"); - grpc_byte_buffer_destroy(pc->p2s_msg); } static void on_c2p_sent_status(void *arg, int success) {