Fixed descriptors leak on process creation.
The leak has been introduced in
This closes issue in GitHub.
@@ -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);
