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