Skip to content

Commit ce10522

Browse files
committed
Fix confusing code in SignatureVerifier_OpenSSL
Note constructor always sets both things so no leak can actually occur
1 parent 6081818 commit ce10522

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/SignatureVerifier_OpenSSL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ SignatureVerifier_OpenSSL::set_modulus_base64_(basic_Error & e, std::string cons
181181
// Requirements for RSA_set0_key() below is that the first time we call it, both n and e must
182182
// be set. So in case e has not been set we allocate a dummy BIGNUM here and use that.
183183
exp = BN_new();
184-
if (exp == NULL) { e.set(api::main(), errors::Subsystem::SignatureVerifier, BN_NEW_FAILED); return; }
184+
if (exp == NULL) { e.set(api::main(), errors::Subsystem::SignatureVerifier, BN_NEW_FAILED); BN_free(n); return; }
185185
} else {
186186
// If e is already set it is owned by this->rsa, and it is not a valid argument to RSA_set0_key()
187187
exp = NULL;
@@ -218,7 +218,7 @@ SignatureVerifier_OpenSSL::set_exponent_base64_(basic_Error & e, std::string con
218218
// Requirements for RSA_set0_key() below is that the first time we call it, both n and e must
219219
// be set. So in case n has not been set we allocate a dummy BIGNUM here and use that.
220220
n = BN_new();
221-
if (n == NULL) { e.set(api::main(), errors::Subsystem::SignatureVerifier, BN_NEW_FAILED); return; }
221+
if (n == NULL) { e.set(api::main(), errors::Subsystem::SignatureVerifier, BN_NEW_FAILED); BN_free(exp); return; }
222222
} else {
223223
// If n is already set it is owned by this->rsa, and it is not a valid argument to RSA_set0_key()
224224
n = NULL;

0 commit comments

Comments
 (0)