summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2021-09-08 10:12:23 +0200
committerGitHub <noreply@github.com>2021-09-08 10:12:23 +0200
commit2de5587547247e3acdffecae1c74caf52a021580 (patch)
tree65405417c62008ffcf73a6721bc032b69775279e /ext
parentc04117134ecb07fb6379bfe1057c9da8e0c4f206 (diff)
fix(ext/http): resource leak if request body is not consumed (#11955)
Diffstat (limited to 'ext')
-rw-r--r--ext/http/01_http.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/http/01_http.js b/ext/http/01_http.js
index 073cc7a7c..2e742d097 100644
--- a/ext/http/01_http.js
+++ b/ext/http/01_http.js
@@ -297,6 +297,13 @@
ws[_eventLoop]();
}
+ } else {
+ // Try to close "request" resource. It might have been already consumed,
+ // but if it hasn't been we need to close it here to avoid resource leak.
+ try {
+ SetPrototypeDelete(httpConn.managedResources, requestRid);
+ core.close(requestRid);
+ } catch { /* pass */ }
}
};
}