summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-06-30 14:58:19 +0200
committerAnna Henningsen <anna@addaleax.net>2018-07-03 19:22:34 +0200
commit6e16ad7a63ba843aafa1284e51ce220a775e11d8 (patch)
treef6ada7e8765524f6082ffc9c8009555d6f77a288 /src
parent908518d9e348581c72a6302ed1bf518b57d5ae0b (diff)
downloadandroid-node-v8-6e16ad7a63ba843aafa1284e51ce220a775e11d8.tar.gz
android-node-v8-6e16ad7a63ba843aafa1284e51ce220a775e11d8.tar.bz2
android-node-v8-6e16ad7a63ba843aafa1284e51ce220a775e11d8.zip
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')
-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 de8b033589..8e30241f4e 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();
}