Fix #650: CKey::SetSecret BIGNUM leak

This commit is contained in:
Pieter Wuille 2012-02-19 18:44:51 +01:00
parent e0b8d459b1
commit a09f101f14
1 changed files with 4 additions and 1 deletions

View File

@ -144,7 +144,10 @@ public:
if (bn == NULL)
throw key_error("CKey::SetSecret() : BN_bin2bn failed");
if (!EC_KEY_regenerate_key(pkey,bn))
{
BN_clear_free(bn);
throw key_error("CKey::SetSecret() : EC_KEY_regenerate_key failed");
}
BN_clear_free(bn);
fSet = true;
if (fCompressed || fCompressedPubKey)