Skip to content

Commit 4b56385

Browse files
committed
update.ts: Fix response memory leak
1 parent a39e22b commit 4b56385

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node/update.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@ export class UpdateProvider {
106106
const httpx = uri.startsWith("https") ? https : http
107107
const client = httpx.get(uri, { headers: { "User-Agent": "code-server" } }, (response) => {
108108
if (!response.statusCode || response.statusCode < 200 || response.statusCode >= 400) {
109+
response.destroy()
109110
return reject(new Error(`${uri}: ${response.statusCode || "500"}`))
110111
}
111112

112113
if (response.statusCode >= 300) {
113-
++redirects
114114
response.destroy()
115+
++redirects
115116
if (redirects > maxRedirects) {
116117
return reject(new Error("reached max redirects"))
117118
}

0 commit comments

Comments
 (0)