summaryrefslogtreecommitdiff
path: root/src/node_crypto.h
diff options
context:
space:
mode:
authorMathias Buus <mathiasbuus@gmail.com>2018-08-30 03:23:41 +0200
committerAnna Henningsen <anna@addaleax.net>2018-09-02 12:48:35 +0200
commit1287e524eeba4632decce231da161426efb8fc34 (patch)
tree2af8ae543babcefde5c8a204c5727e9e876acee8 /src/node_crypto.h
parentec75ba6f0a99c2549e21026904a35f236808638d (diff)
downloadandroid-node-v8-1287e524eeba4632decce231da161426efb8fc34.tar.gz
android-node-v8-1287e524eeba4632decce231da161426efb8fc34.tar.bz2
android-node-v8-1287e524eeba4632decce231da161426efb8fc34.zip
src: fix external memory usage going negative
PR-URL: https://github.com/nodejs/node/pull/22594 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src/node_crypto.h')
-rw-r--r--src/node_crypto.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/node_crypto.h b/src/node_crypto.h
index 269bccbc03..692978412f 100644
--- a/src/node_crypto.h
+++ b/src/node_crypto.h
@@ -198,7 +198,9 @@ class SecureContext : public BaseObject {
}
inline void Reset() {
- env()->isolate()->AdjustAmountOfExternalAllocatedMemory(-kExternalSize);
+ if (ctx_ != nullptr) {
+ env()->isolate()->AdjustAmountOfExternalAllocatedMemory(-kExternalSize);
+ }
ctx_.reset();
cert_.reset();
issuer_.reset();