mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 21:59:10 +02:00
fix a memory leak in key.cpp
- add EC_KEY_free() in CKey::Reset() when pkey != NULL - init pkey with NULL in CKey constructor
This commit is contained in:
committed by
Luke Dashjr
parent
90712378a7
commit
04d4c0e444
@@ -73,6 +73,8 @@ public:
|
||||
void Reset()
|
||||
{
|
||||
fCompressedPubKey = false;
|
||||
if (pkey != NULL)
|
||||
EC_KEY_free(pkey);
|
||||
pkey = EC_KEY_new_by_curve_name(NID_secp256k1);
|
||||
if (pkey == NULL)
|
||||
throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed");
|
||||
@@ -81,6 +83,7 @@ public:
|
||||
|
||||
CKey()
|
||||
{
|
||||
pkey = NULL;
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user