aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2012-06-22 08:38:48 -0700
committerGregory Maxwell <greg@xiph.org>2012-06-22 08:38:48 -0700
commita3869547e5ea4ff92ff534c2f24571165dc2dd02 (patch)
treeebdcbc4a2413f2b524a0f174cb670c2fc83b3c1f /src
parenta08e1826981e02c7a5f18fc30b4f40a780e4e86d (diff)
parenta3d12f445ab17141c52a20bc53e6533a9410ccc9 (diff)
downloadbitcoin-a3869547e5ea4ff92ff534c2f24571165dc2dd02.tar.xz
Merge pull request #1495 from Diapolo/fix_CKey_mem_leak
fix a memory leak in key.cpp
Diffstat (limited to 'src')
-rw-r--r--src/key.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/key.cpp b/src/key.cpp
index 57ab842bc4..c943a38ea6 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -129,6 +129,8 @@ void CKey::SetCompressedPubKey()
void CKey::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");
@@ -137,6 +139,7 @@ void CKey::Reset()
CKey::CKey()
{
+ pkey = NULL;
Reset();
}