summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_main_process.c
diff options
context:
space:
mode:
authorTiago Natel <t.nateldemoura@f5.com>2019-09-20 13:12:04 +0000
committerTiago Natel <t.nateldemoura@f5.com>2019-09-20 13:12:04 +0000
commit20628c74fa315a1dae6bea64ad365d544bf80510 (patch)
tree9af58fefa69f3a36882876574470d7e7720eed3b /src/nxt_main_process.c
parent7f389c814a46d86c3294466826058cd2ed7b2f98 (diff)
downloadunit-20628c74fa315a1dae6bea64ad365d544bf80510.tar.gz
unit-20628c74fa315a1dae6bea64ad365d544bf80510.tar.bz2
Releasing init struct in case of errors.
Found by Coverity (CID 349485).
Diffstat (limited to 'src/nxt_main_process.c')
-rw-r--r--src/nxt_main_process.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index 44deb272..3ec44d83 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -661,7 +661,7 @@ nxt_main_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
ret = nxt_user_cred_get(task, init->user_cred, group);
if (ret != NXT_OK) {
- return NXT_ERROR;
+ goto fail;
}
} else {
@@ -670,7 +670,7 @@ nxt_main_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
{
nxt_alert(task, "cannot set user \"%V\" for app \"%V\": "
"missing capabilities", &app_conf->user, &app_conf->name);
- return NXT_ERROR;
+ goto fail;
}
if (app_conf->group.length > 0
@@ -680,7 +680,7 @@ nxt_main_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
nxt_alert(task, "cannot set group \"%V\" for app \"%V\": "
"missing capabilities", &app_conf->group,
&app_conf->name);
- return NXT_ERROR;
+ goto fail;
}
last = nxt_pointer_to(init, sizeof(nxt_process_init_t));
@@ -702,10 +702,16 @@ nxt_main_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
ret = nxt_init_set_isolation(task, init, app_conf->isolation);
if (nxt_slow_path(ret != NXT_OK)) {
- return NXT_ERROR;
+ goto fail;
}
return nxt_main_create_worker_process(task, rt, init);
+
+fail:
+
+ nxt_free(init);
+
+ return NXT_ERROR;
}