mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-12 12:52:35 -03:00
Merge pull request #1495 from Diapolo/fix_CKey_mem_leak
fix a memory leak in key.cpp
This commit is contained in:
commit
a3869547e5
1 changed files with 3 additions and 0 deletions
|
@ -129,6 +129,8 @@ void CKey::SetCompressedPubKey()
|
||||||
void CKey::Reset()
|
void CKey::Reset()
|
||||||
{
|
{
|
||||||
fCompressedPubKey = false;
|
fCompressedPubKey = false;
|
||||||
|
if (pkey != NULL)
|
||||||
|
EC_KEY_free(pkey);
|
||||||
pkey = EC_KEY_new_by_curve_name(NID_secp256k1);
|
pkey = EC_KEY_new_by_curve_name(NID_secp256k1);
|
||||||
if (pkey == NULL)
|
if (pkey == NULL)
|
||||||
throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed");
|
throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed");
|
||||||
|
@ -137,6 +139,7 @@ void CKey::Reset()
|
||||||
|
|
||||||
CKey::CKey()
|
CKey::CKey()
|
||||||
{
|
{
|
||||||
|
pkey = NULL;
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue