diff options
author | Max Romanov <max.romanov@nginx.com> | 2021-03-02 19:33:37 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2021-03-02 19:33:37 +0300 |
commit | 1950d0aee2bc95f1cb6a07349f11eb5e5f6edf5c (patch) | |
tree | 7b52fcc926805dcac800aa2bd9312877fd466462 /src/nxt_port_memory.c | |
parent | 73ac0496feb38ef2098163847206d304cf2c9a73 (diff) | |
download | unit-1950d0aee2bc95f1cb6a07349f11eb5e5f6edf5c.tar.gz unit-1950d0aee2bc95f1cb6a07349f11eb5e5f6edf5c.tar.bz2 |
Closing app outgoing shared memory file descriptor.
This fixes file descriptor leakage in router. Shared memory file used to
send data from router to application. These files are shared among all
processes of same application and router keeps the opened file descriptor since
06017e6e3a5f commit.
Diffstat (limited to 'src/nxt_port_memory.c')
-rw-r--r-- | src/nxt_port_memory.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nxt_port_memory.c b/src/nxt_port_memory.c index ae9f079c..bffae8a1 100644 --- a/src/nxt_port_memory.c +++ b/src/nxt_port_memory.c @@ -34,6 +34,10 @@ nxt_port_mmap_handler_use(nxt_port_mmap_handler_t *mmap_handler, int i) mmap_handler->hdr = NULL; } + if (mmap_handler->fd != -1) { + nxt_fd_close(mmap_handler->fd); + } + nxt_free(mmap_handler); } } @@ -238,6 +242,7 @@ nxt_port_incoming_port_mmap(nxt_task_t *task, nxt_process_t *process, } mmap_handler->hdr = hdr; + mmap_handler->fd = -1; if (nxt_slow_path(hdr->src_pid != process->pid || hdr->dst_pid != nxt_pid)) |