Skip to content

Commit d0c968e

Browse files
committed
src: make root_cert_vector function scoped
root_cert_vector currently has file scope and external linkage, but is only used in the NewRootCertsStore function. If this is not required to be externally linked perhaps it can be changed to be static and function scoped instead. PR-URL: #12788 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Shigeki Ohtsu <[email protected]>
1 parent ebcd8c6 commit d0c968e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_crypto.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ const char* const root_certs[] = {
152152
std::string extra_root_certs_file; // NOLINT(runtime/string)
153153

154154
X509_STORE* root_cert_store;
155-
std::vector<X509*> root_certs_vector;
156155

157156
// Just to generate static methods
158157
template class SSLWrap<TLSWrap>;
@@ -724,6 +723,7 @@ static int X509_up_ref(X509* cert) {
724723

725724

726725
static X509_STORE* NewRootCertStore() {
726+
static std::vector<X509*> root_certs_vector;
727727
if (root_certs_vector.empty()) {
728728
for (size_t i = 0; i < arraysize(root_certs); i++) {
729729
BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i]));

0 commit comments

Comments
 (0)