diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-10-03 20:45:42 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-10-03 23:46:01 +0300 |
commit | f5c7aa0c82a41d5d5a5af45f81b9517132bea849 (patch) | |
tree | 6d12ecc57911f11ce4935265aaf3ff976efd0299 /src | |
parent | 35b17d9abd123853a8e035ca7bc185f7e942d73b (diff) |
crypto: fix KeyObject garbage collection
These objects don’t hold any resources on the event loop, so they
should be weak objects that can be garbage collected when nothing
refers to them anymore.
PR-URL: https://github.com/nodejs/node/pull/35481
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_crypto.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/node_crypto.h b/src/node_crypto.h index 8f781035602..bef98b3e244 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -519,7 +519,9 @@ class NativeKeyObject : public BaseObject { v8::Local<v8::Object> wrap, const std::shared_ptr<KeyObjectData>& handle_data) : BaseObject(env, wrap), - handle_data_(handle_data) {} + handle_data_(handle_data) { + MakeWeak(); + } std::shared_ptr<KeyObjectData> handle_data_; }; |