From 32223cf5e1931f21a18f6f7494aa53a4671b25f0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 10:01:29 -0800 Subject: Fix fling test leaks --- test/core/fling/client.c | 4 ++-- test/core/fling/server.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'test/core/fling') diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 6262699631..0a113f033f 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -55,7 +55,6 @@ static grpc_op stream_step_ops[2]; static grpc_metadata_array initial_metadata_recv; static grpc_metadata_array trailing_metadata_recv; static grpc_byte_buffer *response_payload_recv = NULL; -static grpc_call_details call_details; static grpc_status_code status; static char *details = NULL; static size_t details_capacity = 0; @@ -64,7 +63,6 @@ static grpc_op *op; static void init_ping_pong_request(void) { grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); - grpc_call_details_init(&call_details); op = ops; @@ -97,6 +95,7 @@ static void step_ping_pong_request(void) { grpc_call_start_batch(call, ops, op - ops, (void *)1)); grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); grpc_call_destroy(call); + grpc_byte_buffer_destroy(response_payload_recv); call = NULL; } @@ -121,6 +120,7 @@ static void step_ping_pong_stream(void) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, stream_step_ops, 2, (void *)1)); grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); + grpc_byte_buffer_destroy(response_payload_recv); } static double now(void) { diff --git a/test/core/fling/server.c b/test/core/fling/server.c index bc52059b38..ca0683fa67 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -87,7 +87,6 @@ typedef struct { static void request_call(void) { grpc_metadata_array_init(&request_metadata_recv); - grpc_call_details_init(&call_details); grpc_server_request_call(server, &call, &call_details, &request_metadata_recv, cq, tag(FLING_SERVER_NEW_REQUEST)); } @@ -218,6 +217,8 @@ int main(int argc, char **argv) { gpr_free(addr_buf); addr = addr_buf = NULL; + grpc_call_details_init(&call_details); + request_call(); grpc_profiler_start("server.prof"); @@ -264,6 +265,8 @@ int main(int argc, char **argv) { break; case FLING_SERVER_WRITE_FOR_STREAMING: /* Write completed at server */ + grpc_byte_buffer_destroy(payload_buffer); + payload_buffer = NULL; start_read_op(FLING_SERVER_READ_FOR_STREAMING); break; case FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING: @@ -282,6 +285,8 @@ int main(int argc, char **argv) { break; case FLING_SERVER_BATCH_OPS_FOR_UNARY: /* Finished unary call. */ + grpc_byte_buffer_destroy(payload_buffer); + payload_buffer = NULL; grpc_call_destroy(call); request_call(); break; @@ -305,6 +310,7 @@ int main(int argc, char **argv) { grpc_event_finish(ev); } grpc_profiler_stop(); + grpc_call_details_destroy(&call_details); grpc_server_destroy(server); grpc_completion_queue_destroy(cq); -- cgit v1.2.3