diff options
Diffstat (limited to 'xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx')
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 0abcc363dd18..0da6276551af 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -841,9 +841,11 @@ xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() { if (auto pCertificate = dynamic_cast<X509Certificate_NssImpl*>(m_xSigningCertificate.get())) { SECKEYPrivateKey* pPrivateKey = pCertificate->getPrivateKey(); - if (pPrivateKey) + SECKEYPrivateKey* copy + = pPrivateKey == nullptr ? nullptr : SECKEY_CopyPrivateKey(pPrivateKey); + if (copy) { - xmlSecKeyDataPtr pKeyData = xmlSecNssPKIAdoptKey(pPrivateKey, nullptr); + xmlSecKeyDataPtr pKeyData = xmlSecNssPKIAdoptKey(copy, nullptr); xmlSecKeyPtr pKey = xmlSecKeyCreate(); xmlSecKeySetValue(pKey, pKeyData); xmlSecNssAppDefaultKeysMngrAdoptKey(pKeysMngr, pKey); |