@@ -127,7 +127,7 @@ const char* const root_certs[] = { |
127 | 127 | std::string extra_root_certs_file; // NOLINT(runtime/string) |
128 | 128 |
|
129 | 129 | X509_STORE* root_cert_store; |
130 | | -std::vector<X509*>* root_certs_vector; |
| 130 | +std::vector<X509*> root_certs_vector; |
131 | 131 |
|
132 | 132 | // Just to generate static methods |
133 | 133 | template class SSLWrap<TLSWrap>; |
@@ -694,9 +694,7 @@ static int X509_up_ref(X509* cert) { |
694 | 694 |
|
695 | 695 |
|
696 | 696 | static X509_STORE* NewRootCertStore() { |
697 | | - if (!root_certs_vector) { |
698 | | - root_certs_vector = new std::vector<X509*>; |
699 | | - |
| 697 | + if (root_certs_vector.empty()) { |
700 | 698 | for (size_t i = 0; i < arraysize(root_certs); i++) { |
701 | 699 | BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i])); |
702 | 700 | X509 *x509 = PEM_read_bio_X509(bp, nullptr, CryptoPemCallback, nullptr); |
@@ -705,12 +703,12 @@ static X509_STORE* NewRootCertStore() { |
705 | 703 | // Parse errors from the built-in roots are fatal. |
706 | 704 | CHECK_NE(x509, nullptr); |
707 | 705 |
|
708 | | - root_certs_vector->push_back(x509); |
| 706 | + root_certs_vector.push_back(x509); |
709 | 707 | } |
710 | 708 | } |
711 | 709 |
|
712 | 710 | X509_STORE* store = X509_STORE_new(); |
713 | | - for (auto& cert : *root_certs_vector) { |
| 711 | + for (X509 *cert : root_certs_vector) { |
714 | 712 | X509_up_ref(cert); |
715 | 713 | X509_STORE_add_cert(store, cert); |
716 | 714 | } |
|