diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-02-19 18:44:51 +0100 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-02-27 12:42:48 -0500 |
commit | 471e0bdc7cc79a993230672dadbd193218b6103c (patch) | |
tree | 0e3e4000dedf4f8921f8bf319cebd99acf232859 /src/key.h | |
parent | caad1add4f383960ca09bb466ddd16652245befe (diff) | |
download | bitcoin-471e0bdc7cc79a993230672dadbd193218b6103c.tar.xz |
Fix #650: CKey::SetSecret BIGNUM leak
Diffstat (limited to 'src/key.h')
-rw-r--r-- | src/key.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -153,10 +153,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; return true; |