diff --git a/lib/zlib.js b/lib/zlib.js index ca5f05884ad3c0..87e8641767669f 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -527,14 +527,12 @@ function processChunkSync(self, chunk, flushFlag) { } self.bytesWritten = inputRead; + _close(self); if (nread >= kMaxLength) { - _close(self); throw new ERR_BUFFER_TOO_LARGE(); } - _close(self); - if (nread === 0) return Buffer.alloc(0);