From ae30b391c2fa9fbc7ca4ce59ff1b786816ed4550 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 10 Jan 2022 18:53:21 -0800 Subject: [PATCH] stream: fix error-path function call The `onFinish()` function takes a single argument. The two extra arguments passed here are already in the function scope, and may result in the error being mishandled. PR-URL: https://github.com/nodejs/node/pull/41433 Reviewed-By: Robert Nagy Reviewed-By: Luigi Pinca Reviewed-By: Anatoli Papirovski Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum Reviewed-By: Mohammed Keyvanzadeh --- lib/internal/streams/writable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/streams/writable.js b/lib/internal/streams/writable.js index d0d4e7fb615205..5211a1ce89395e 100644 --- a/lib/internal/streams/writable.js +++ b/lib/internal/streams/writable.js @@ -710,7 +710,7 @@ function callFinal(stream, state) { } } } catch (err) { - onFinish(stream, state, err); + onFinish(err); } state.sync = false;