Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-06-30 15:58:19 +0300
committerAnna Henningsen <anna@addaleax.net>2018-07-03 20:22:34 +0300
commit6e16ad7a63ba843aafa1284e51ce220a775e11d8 (patch)
treef6ada7e8765524f6082ffc9c8009555d6f77a288 /src/node_zlib.cc
parent908518d9e348581c72a6302ed1bf518b57d5ae0b (diff)
zlib: fix memory leak for unused zlib instances
An oversight in an earlier commit led to a memory leak in the untypical situation that zlib instances are created but never used, because zlib handles no longer started out their life as weak handles. The bug was introduced in bd201102862a194f3f5ce669e0a3c8143eafc900. Refs: https://github.com/nodejs/node/pull/20455 PR-URL: https://github.com/nodejs/node/pull/21607 Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src/node_zlib.cc')
-rw-r--r--src/node_zlib.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index de8b0335892..8e30241f4e6 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -90,6 +90,7 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork {
refs_(0),
gzip_id_bytes_read_(0),
write_result_(nullptr) {
+ MakeWeak();
}