| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d3a7fb8 commit bf882fb
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -785,6 +785,8 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo<Value>& args) { | |||
| 785 | 785 | } | |
| 786 | 786 | ||
| 787 | 787 | sc->ca_store_ = root_cert_store; | |
| 788 | + // Increment reference count so global store is not deleted along with CTX. | ||
| 789 | + CRYPTO_add(&root_cert_store->references, 1, CRYPTO_LOCK_X509_STORE); | ||
| 788 | 790 | SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_); | |
| 789 | 791 | } | |
| 790 | 792 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -140,13 +140,6 @@ class SecureContext : public BaseObject { | |||
| 140 | 140 | void FreeCTXMem() { | |
| 141 | 141 | if (ctx_) { | |
| 142 | 142 | env()->isolate()->AdjustAmountOfExternalAllocatedMemory(-kExternalSize); | |
| 143 | - if (ctx_->cert_store == root_cert_store) { | ||
| 144 | - // SSL_CTX_free() will attempt to free the cert_store as well. | ||
| 145 | - // Since we want our root_cert_store to stay around forever | ||
| 146 | - // we just clear the field. Hopefully OpenSSL will not modify this | ||
| 147 | - // struct in future versions. | ||
| 148 | - ctx_->cert_store = nullptr; | ||
| 149 | - } | ||
| 150 | 143 | SSL_CTX_free(ctx_); | |
| 151 | 144 | if (cert_ != nullptr) | |
| 152 | 145 | X509_free(cert_); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments