summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2017-09-16 05:36:06 +0300
committerValentin Bartenev <vbart@nginx.com>2017-09-16 05:36:06 +0300
commit75a63256563a1eaf13fbd182800070849c3beb52 (patch)
tree219ad905526ba61f4cdbe6a37f4d652bd1ea5320 /src
parente5b4594376454bc52cd462d42fdc7e46aad80596 (diff)
downloadunit-75a63256563a1eaf13fbd182800070849c3beb52.tar.gz
unit-75a63256563a1eaf13fbd182800070849c3beb52.tar.bz2
Fixed memory leak caused by mempool related to request context.
The previous attempt of fixing this in e5a65b58101f hasn't been really successful, because the actual memory leak was caused not by the request parse context itself, but its memory pool.
Diffstat (limited to 'src')
-rw-r--r--src/nxt_application.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c
index 30b9d1fa..3b87dbf0 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -784,21 +784,17 @@ nxt_app_http_req_init(nxt_task_t *task)
return NULL;
}
- ctx = nxt_mp_retain(mp, sizeof(nxt_app_parse_ctx_t));
+ ctx = nxt_mp_zget(mp, sizeof(nxt_app_parse_ctx_t));
if (nxt_slow_path(ctx == NULL)) {
nxt_mp_destroy(mp);
-
return NULL;
}
- nxt_memzero(ctx, sizeof(nxt_app_parse_ctx_t));
-
ctx->mem_pool = mp;
rc = nxt_http_parse_request_init(&ctx->parser, mp);
if (nxt_slow_path(rc != NXT_OK)) {
- nxt_mp_release(mp, ctx);
-
+ nxt_mp_destroy(mp);
return NULL;
}
@@ -897,7 +893,7 @@ nxt_app_http_req_body_read(nxt_task_t *task, nxt_app_parse_ctx_t *ctx,
nxt_int_t
nxt_app_http_req_done(nxt_task_t *task, nxt_app_parse_ctx_t *ctx)
{
- nxt_mp_release(ctx->mem_pool, ctx);
+ nxt_mp_destroy(ctx->mem_pool);
return NXT_OK;
}