aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-01-30 09:41:25 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-01-30 09:41:25 -0800
commit924e1bbe1ed503f5b15397b1ba845adff611d724 (patch)
tree1f68421f8ffdd6e3fdc5f7893aa114d80e208a94 /src
parent05b034dbd15a9bb9db3d1910248cf2aa3dd50172 (diff)
Free some leaks in http_server_filter
Diffstat (limited to 'src')
-rw-r--r--src/core/channel/http_server_filter.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c
index 2658a6d42e..3e5bb0506a 100644
--- a/src/core/channel/http_server_filter.c
+++ b/src/core/channel/http_server_filter.c
@@ -319,8 +319,8 @@ static void init_channel_elem(grpc_channel_element *elem,
if (channeld->gettable_count == gettable_capacity) {
gettable_capacity =
GPR_MAX(gettable_capacity * 3 / 2, gettable_capacity + 1);
- channeld->gettables =
- gpr_realloc(channeld->gettables, gettable_capacity * sizeof(gettable));
+ channeld->gettables = gpr_realloc(channeld->gettables,
+ gettable_capacity * sizeof(gettable));
}
g = &channeld->gettables[channeld->gettable_count++];
g->path = grpc_mdelem_from_strings(mdctx, ":path", p->path);
@@ -334,9 +334,17 @@ static void init_channel_elem(grpc_channel_element *elem,
/* Destructor for channel data */
static void destroy_channel_elem(grpc_channel_element *elem) {
+ size_t i;
+
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
+ for (i = 0; i < channeld->gettable_count; i++) {
+ grpc_mdelem_unref(channeld->gettables[i].path);
+ grpc_mdelem_unref(channeld->gettables[i].content_type);
+ }
+ gpr_free(channeld->gettables);
+
grpc_mdelem_unref(channeld->te_trailers);
grpc_mdelem_unref(channeld->status_ok);
grpc_mdelem_unref(channeld->status_not_found);
@@ -350,6 +358,6 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_http_server_filter = {
- call_op, channel_op, sizeof(call_data),
- init_call_elem, destroy_call_elem, sizeof(channel_data),
- init_channel_elem, destroy_channel_elem, "http-server"};
+ call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(channel_data), init_channel_elem, destroy_channel_elem,
+ "http-server"};