Skip to content

Commit d1826fe

Browse files
cjihrigtargos
authored andcommitted
http2: close fd in doSendFileFD()
This commit closes the file descriptor in two code paths that return from doSendFileFD(). PR-URL: #23047 Fixes: #23029 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 4cda83d commit d1826fe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/internal/http2/core.js

+2
Original file line numberDiff line numberDiff line change
@@ -2149,6 +2149,7 @@ function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
21492149
isDirectory) {
21502150
const err = isDirectory ?
21512151
new ERR_HTTP2_SEND_FILE() : new ERR_HTTP2_SEND_FILE_NOSEEK();
2152+
tryClose(fd);
21522153
if (onError)
21532154
onError(err);
21542155
else
@@ -2179,6 +2180,7 @@ function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
21792180
if ((typeof options.statCheck === 'function' &&
21802181
options.statCheck.call(this, stat, headers) === false) ||
21812182
(this[kState].flags & STREAM_FLAGS_HEADERS_SENT)) {
2183+
tryClose(fd);
21822184
return;
21832185
}
21842186

0 commit comments

Comments
 (0)