diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-06-21 12:05:06 +0200 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-07-05 22:56:10 +0000 |
commit | 04d4c0e444d9b02d5d9ba7893052f8c75cfdfed9 (patch) | |
tree | 477b1899c9745b341dde6030656d70a02d4ea961 /src/key.h | |
parent | 90712378a73337f4ec5451da72d255f9f13664c0 (diff) | |
download | bitcoin-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.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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(); } |