From df1d3da924a746cebce263ce3aa37027a13f55ce Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Thu, 1 Sep 2016 13:51:42 -0700
Subject: [PATCH] Fix leaks

---
 src/core/ext/transport/chttp2/transport/chttp2_transport.c | 6 ++++++
 src/core/lib/surface/server.c                              | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
index ba2bf91b92..94440a9539 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
@@ -162,6 +162,12 @@ static void destruct_transport(grpc_exec_ctx *exec_ctx,
     gpr_free(ping);
   }
 
+  while (t->write_cb_pool) {
+    grpc_chttp2_write_cb *next = t->write_cb_pool->next;
+    gpr_free(t->write_cb_pool);
+    t->write_cb_pool = next;
+  }
+
   gpr_free(t->peer_string);
   gpr_free(t);
 }
diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c
index 041fd234ba..9a517b0a7a 100644
--- a/src/core/lib/surface/server.c
+++ b/src/core/lib/surface/server.c
@@ -446,6 +446,13 @@ static void destroy_channel(grpc_exec_ctx *exec_ctx, channel_data *chand,
     grpc_error_free_string(msg);
   }
   GRPC_ERROR_UNREF(error);
+
+  grpc_transport_op *op = grpc_make_transport_op(&chand->finish_destroy_channel_closure);
+  op->set_accept_stream = true;
+  grpc_channel_next_op(exec_ctx,
+                       grpc_channel_stack_element(
+                           grpc_channel_get_channel_stack(chand->channel), 0),
+                       op);
 }
 
 static void cpstr(char **dest, size_t *capacity, grpc_mdstr *value) {
-- 
GitLab