summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2019-09-26 16:03:01 +0300
committerValentin Bartenev <vbart@nginx.com>2019-09-26 16:03:01 +0300
commit9c06bfdf2c30d4a414ae803bf36543a9c9a40f66 (patch)
tree51cc91c67ad8e92b2c301b4e28d3b86de01bd1f6
parentd82f125368d7d19300789ddd41587c09ffdcf36a (diff)
downloadunit-9c06bfdf2c30d4a414ae803bf36543a9c9a40f66.tar.gz
unit-9c06bfdf2c30d4a414ae803bf36543a9c9a40f66.tar.bz2
Fixed descriptors leak on process creation.
The leak has been introduced in 325b315e48c4. This closes #322 issue in GitHub.
Diffstat (limited to '')
-rw-r--r--src/nxt_process.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nxt_process.c b/src/nxt_process.c
index 638765a4..d83eed28 100644
--- a/src/nxt_process.c
+++ b/src/nxt_process.c
@@ -166,6 +166,14 @@ nxt_process_create(nxt_task_t *task, nxt_process_t *process)
init->name, nxt_errno);
#endif
+ if (nxt_slow_path(close(pipefd[0]) != 0)) {
+ nxt_alert(task, "failed to close pipe: %E", nxt_errno);
+ }
+
+ if (nxt_slow_path(close(pipefd[1]) != 0)) {
+ nxt_alert(task, "failed to close pipe: %E", nxt_errno);
+ }
+
return pid;
}
@@ -230,6 +238,10 @@ nxt_process_create(nxt_task_t *task, nxt_process_t *process)
goto fail_cleanup;
}
+ if (nxt_slow_path(close(pipefd[1]) != 0)) {
+ nxt_alert(task, "failed to close pipe: %E", nxt_errno);
+ }
+
process->pid = pid;
nxt_runtime_process_add(task, process);