From 9c06bfdf2c30d4a414ae803bf36543a9c9a40f66 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Thu, 26 Sep 2019 16:03:01 +0300 Subject: Fixed descriptors leak on process creation. The leak has been introduced in 325b315e48c4. This closes #322 issue in GitHub. --- src/nxt_process.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nxt_process.c') 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); -- cgit