From: Remi Gacogne Date: Wed, 11 Oct 2017 13:28:04 +0000 (+0200) Subject: Fix a memory leak when loading an RSA key with an invalid modulus X-Git-Tag: auth-4.1.0~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4238b337d28c1f300478144e210c41e8bd9dbce;p=thirdparty%2Fpdns.git Fix a memory leak when loading an RSA key with an invalid modulus --- diff --git a/pdns/opensslsigners.cc b/pdns/opensslsigners.cc index 051734aba9..8e3bb547bd 100644 --- a/pdns/opensslsigners.cc +++ b/pdns/opensslsigners.cc @@ -474,7 +474,7 @@ void OpenSSLRSADNSCryptoKeyEngine::fromISCMap(DNSKEYRecordContent& drc, std::map if (iqmp == NULL) { RSA_free(key); BN_clear_free(dmq1); - BN_clear_free(iqmp); + BN_clear_free(dmp1); throw runtime_error(getName()+" allocation of BIGNUM iqmp failed"); } RSA_set0_crt_params(key, dmp1, dmq1, iqmp); @@ -562,6 +562,7 @@ void OpenSSLRSADNSCryptoKeyEngine::fromPublicKeyString(const std::string& input) BIGNUM *n = BN_bin2bn((unsigned char*)modulus.c_str(), modulus.length(), NULL); if (!n) { RSA_free(key); + BN_clear_free(e); throw runtime_error(getName()+" error loading n value of public key"); }