summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_unit.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-10-28 00:01:46 +0300
committerMax Romanov <max.romanov@nginx.com>2020-10-28 00:01:46 +0300
commit131b6a7ffab7b3303a00a50f5cf764dc99e23cc0 (patch)
treee777aa0674cd2c74bf742e887c06d31e654068a3 /src/nxt_unit.c
parenta5508cec7a55fe04ab66451c7510fab0e0d4577c (diff)
downloadunit-131b6a7ffab7b3303a00a50f5cf764dc99e23cc0.tar.gz
unit-131b6a7ffab7b3303a00a50f5cf764dc99e23cc0.tar.bz2
Libunit: releasing cached read buffers when destroying context.
Diffstat (limited to '')
-rw-r--r--src/nxt_unit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nxt_unit.c b/src/nxt_unit.c
index 6a0657c6..7d2bf2c7 100644
--- a/src/nxt_unit.c
+++ b/src/nxt_unit.c
@@ -5023,6 +5023,7 @@ nxt_unit_ctx_free(nxt_unit_ctx_impl_t *ctx_impl)
{
nxt_unit_impl_t *lib;
nxt_unit_mmap_buf_t *mmap_buf;
+ nxt_unit_read_buf_t *rbuf;
nxt_unit_request_info_impl_t *req_impl;
nxt_unit_websocket_frame_impl_t *ws_impl;
@@ -5060,6 +5061,13 @@ nxt_unit_ctx_free(nxt_unit_ctx_impl_t *ctx_impl)
} nxt_queue_loop;
+ nxt_queue_each(rbuf, &ctx_impl->free_rbuf, nxt_unit_read_buf_t, link)
+ {
+ if (rbuf != &ctx_impl->ctx_read_buf) {
+ nxt_unit_free(&ctx_impl->ctx, rbuf);
+ }
+ } nxt_queue_loop;
+
pthread_mutex_destroy(&ctx_impl->mutex);
pthread_mutex_lock(&lib->mutex);