Browse Source

zlib: check cleanup return values

PR-URL: https://github.com/nodejs/node/pull/14673
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Anna Henningsen 7 years ago
parent
commit
2421984727
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 6
      src/node_zlib.cc

6
src/node_zlib.cc

@ -111,16 +111,18 @@ class ZCtx : public AsyncWrap {
CHECK(init_done_ && "close before init");
CHECK_LE(mode_, UNZIP);
int status = Z_OK;
if (mode_ == DEFLATE || mode_ == GZIP || mode_ == DEFLATERAW) {
(void)deflateEnd(&strm_);
status = deflateEnd(&strm_);
int64_t change_in_bytes = -static_cast<int64_t>(kDeflateContextSize);
env()->isolate()->AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
} else if (mode_ == INFLATE || mode_ == GUNZIP || mode_ == INFLATERAW ||
mode_ == UNZIP) {
(void)inflateEnd(&strm_);
status = inflateEnd(&strm_);
int64_t change_in_bytes = -static_cast<int64_t>(kInflateContextSize);
env()->isolate()->AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
}
CHECK(status == Z_OK || status == Z_DATA_ERROR);
mode_ = NONE;
if (dictionary_ != nullptr) {

Loading…
Cancel
Save