aboutsummaryrefslogtreecommitdiff
path: root/src/key.h
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2012-06-21 12:05:06 +0200
committerLuke Dashjr <luke-jr+git@utopios.org>2012-07-05 22:56:10 +0000
commit04d4c0e444d9b02d5d9ba7893052f8c75cfdfed9 (patch)
tree477b1899c9745b341dde6030656d70a02d4ea961 /src/key.h
parent90712378a73337f4ec5451da72d255f9f13664c0 (diff)
downloadbitcoin-04d4c0e444d9b02d5d9ba7893052f8c75cfdfed9.tar.xz
fix a memory leak in key.cpp
- add EC_KEY_free() in CKey::Reset() when pkey != NULL - init pkey with NULL in CKey constructor
Diffstat (limited to 'src/key.h')
-rw-r--r--src/key.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/key.h b/src/key.h
index ba68f0dd70..5986a534f7 100644
--- a/src/key.h
+++ b/src/key.h
@@ -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();
}