diff options
author | Craig Tiller <ctiller@google.com> | 2015-01-30 09:41:25 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-01-31 20:21:07 -0800 |
commit | 5a8a8073b8efbf6c18ff4a161cc8f1e4f291556c (patch) | |
tree | d35a75ffe004d62a2e354970f188b83f2aa84c5c /src/core | |
parent | 7448d3d69e706da3cdf7bf6b81f71955717e4a53 (diff) |
Free some leaks in http_server_filter
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/channel/http_server_filter.c | 18 |
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"}; |