mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Avoid file descriptor leak
`extra_fd` was leaked if `fd_set_cloexec` fails -- I can't think of any chance of that happening here, but just in case. Coverity Scan found this issue.
This commit is contained in:
parent
25602421fb
commit
c07fb79150
Notes:
git
2024-12-18 02:10:31 +00:00
1 changed files with 1 additions and 0 deletions
|
@ -3368,6 +3368,7 @@ run_exec_dup2(VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, s
|
|||
// in #assert_close_on_exec because the FD_CLOEXEC is not dup'd by default
|
||||
if (fd_get_cloexec(pairs[i].oldfd, errmsg, errmsg_buflen)) {
|
||||
if (fd_set_cloexec(extra_fd, errmsg, errmsg_buflen)) {
|
||||
close(extra_fd);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue