summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2019-03-22 15:32:40 +0300
committerMax Romanov <max.romanov@nginx.com>2019-03-22 15:32:40 +0300
commit1b7514dca386e26503eac90bd3518a950d7f9a5c (patch)
tree7c7ef7ecbe3ebf040c7386c69b103099e0bd2e0c
parent687f83fbd00b4f72da06f497f5bfe2af06716a3a (diff)
downloadunit-1b7514dca386e26503eac90bd3518a950d7f9a5c.tar.gz
unit-1b7514dca386e26503eac90bd3518a950d7f9a5c.tar.bz2
Destroying pool in case of error.
This closes #233 issue on GitHub. Thanks to 洪志道 (Hong Zhi Dao).
-rw-r--r--src/nxt_controller.c1
-rw-r--r--src/nxt_runtime.c3
2 files changed, 2 insertions, 2 deletions
diff --git a/src/nxt_controller.c b/src/nxt_controller.c
index 29838bd9..d5534f49 100644
--- a/src/nxt_controller.c
+++ b/src/nxt_controller.c
@@ -184,6 +184,7 @@ nxt_controller_start(nxt_task_t *task, void *data)
vldt.pool = nxt_mp_create(1024, 128, 256, 32);
if (nxt_slow_path(vldt.pool == NULL)) {
+ nxt_mp_destroy(mp);
return NXT_ERROR;
}
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index 547c7494..06478f72 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -53,14 +53,13 @@ nxt_runtime_create(nxt_task_t *task)
nxt_app_lang_module_t *lang;
mp = nxt_mp_create(1024, 128, 256, 32);
-
if (nxt_slow_path(mp == NULL)) {
return NXT_ERROR;
}
rt = nxt_mp_zget(mp, sizeof(nxt_runtime_t));
if (nxt_slow_path(rt == NULL)) {
- return NXT_ERROR;
+ goto fail;
}
task->thread->runtime = rt;