diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-02-19 18:04:46 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-02-19 18:04:46 -0800 |
commit | 49355d999303cf93df68ee63ef6ee32bcf4890d2 (patch) | |
tree | 74a96fce59f4ff9a0d8ef5c4fe7f6f6c681e9712 /src | |
parent | 8a949dd6c3ce8161967330ebabf8ba021c0a6295 (diff) | |
parent | a09f101f147f2313bc727371f8f1e44dc886d330 (diff) | |
download | bitcoin-49355d999303cf93df68ee63ef6ee32bcf4890d2.tar.xz |
Merge pull request #868 from sipa/fix_650
Fix #650: CKey::SetSecret BIGNUM leak
Diffstat (limited to 'src')
-rw-r--r-- | src/key.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -141,10 +141,13 @@ public: if (vchSecret.size() != 32) throw key_error("CKey::SetSecret() : secret must be 32 bytes"); BIGNUM *bn = BN_bin2bn(&vchSecret[0],32,BN_new()); - if (bn == NULL) + 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) |